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