]> git.lyx.org Git - lyx.git/blob - boost/boost/iterator/iterator_traits.hpp
Boost 1.31.0
[lyx.git] / boost / boost / iterator / iterator_traits.hpp
1 // Copyright David Abrahams 2003. Permission to copy, use,
2 // modify, sell and distribute this software is granted provided this
3 // copyright notice appears in all copies. This software is provided
4 // "as is" without express or implied warranty, and with no claim as
5 // to its suitability for any purpose.
6 #ifndef ITERATOR_TRAITS_DWA200347_HPP
7 # define ITERATOR_TRAITS_DWA200347_HPP
8
9 # include <boost/detail/iterator.hpp>
10 # include <boost/detail/workaround.hpp>
11
12 namespace boost { 
13
14 // Unfortunately, g++ 2.95.x chokes when we define a class template
15 // iterator_category which has the same name as its
16 // std::iterator_category() function, probably due in part to the
17 // "std:: is visible globally" hack it uses.  Use
18 // BOOST_ITERATOR_CATEGORY to write code that's portable to older
19 // GCCs.
20
21 # if BOOST_WORKAROUND(__GNUC__, <= 2)
22 #  define BOOST_ITERATOR_CATEGORY iterator_category_
23 # else
24 #  define BOOST_ITERATOR_CATEGORY iterator_category
25 # endif
26
27
28 template <class Iterator>
29 struct iterator_value
30 {
31     typedef typename detail::iterator_traits<Iterator>::value_type type;
32 };
33   
34 template <class Iterator>
35 struct iterator_reference
36 {
37     typedef typename detail::iterator_traits<Iterator>::reference type;
38 };
39   
40   
41 template <class Iterator>
42 struct iterator_pointer
43 {
44     typedef typename detail::iterator_traits<Iterator>::pointer type;
45 };
46   
47 template <class Iterator>
48 struct iterator_difference
49 {
50     typedef typename detail::iterator_traits<Iterator>::difference_type type;
51 };
52
53 template <class Iterator>
54 struct BOOST_ITERATOR_CATEGORY
55 {
56     typedef typename detail::iterator_traits<Iterator>::iterator_category type;
57 };
58
59 # if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
60 template <>
61 struct iterator_value<int>
62 {
63     typedef void type;
64 };
65   
66 template <>
67 struct iterator_reference<int>
68 {
69     typedef void type;
70 };
71
72 template <>
73 struct iterator_pointer<int>
74 {
75     typedef void type;
76 };
77   
78 template <>
79 struct iterator_difference<int>
80 {
81     typedef void type;
82 };
83   
84 template <>
85 struct BOOST_ITERATOR_CATEGORY<int>
86 {
87     typedef void type;
88 };
89 # endif
90
91 } // namespace boost::iterator
92
93 #endif // ITERATOR_TRAITS_DWA200347_HPP