source: NonGTP/Boost/boost/iterator/iterator_traits.hpp @ 857

Revision 857, 2.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2003.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef ITERATOR_TRAITS_DWA200347_HPP
6# define ITERATOR_TRAITS_DWA200347_HPP
7
8# include <boost/detail/iterator.hpp>
9# include <boost/detail/workaround.hpp>
10
11namespace boost {
12
13// Unfortunately, g++ 2.95.x chokes when we define a class template
14// iterator_category which has the same name as its
15// std::iterator_category() function, probably due in part to the
16// "std:: is visible globally" hack it uses.  Use
17// BOOST_ITERATOR_CATEGORY to write code that's portable to older
18// GCCs.
19
20# if BOOST_WORKAROUND(__GNUC__, <= 2)
21#  define BOOST_ITERATOR_CATEGORY iterator_category_
22# else
23#  define BOOST_ITERATOR_CATEGORY iterator_category
24# endif
25
26
27template <class Iterator>
28struct iterator_value
29{
30    typedef typename detail::iterator_traits<Iterator>::value_type type;
31};
32 
33template <class Iterator>
34struct iterator_reference
35{
36    typedef typename detail::iterator_traits<Iterator>::reference type;
37};
38 
39 
40template <class Iterator>
41struct iterator_pointer
42{
43    typedef typename detail::iterator_traits<Iterator>::pointer type;
44};
45 
46template <class Iterator>
47struct iterator_difference
48{
49    typedef typename detail::iterator_traits<Iterator>::difference_type type;
50};
51
52template <class Iterator>
53struct BOOST_ITERATOR_CATEGORY
54{
55    typedef typename detail::iterator_traits<Iterator>::iterator_category type;
56};
57
58# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
59template <>
60struct iterator_value<int>
61{
62    typedef void type;
63};
64 
65template <>
66struct iterator_reference<int>
67{
68    typedef void type;
69};
70
71template <>
72struct iterator_pointer<int>
73{
74    typedef void type;
75};
76 
77template <>
78struct iterator_difference<int>
79{
80    typedef void type;
81};
82 
83template <>
84struct BOOST_ITERATOR_CATEGORY<int>
85{
86    typedef void type;
87};
88# endif
89
90} // namespace boost::iterator
91
92#endif // ITERATOR_TRAITS_DWA200347_HPP
Note: See TracBrowser for help on using the repository browser.