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 11 namespace 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 27 template <class Iterator> 28 struct iterator_value 29 { 30 typedef typename boost::detail::iterator_traits<Iterator>::value_type type; 31 }; 32 33 template <class Iterator> 34 struct iterator_reference 35 { 36 typedef typename boost::detail::iterator_traits<Iterator>::reference type; 37 }; 38 39 40 template <class Iterator> 41 struct iterator_pointer 42 { 43 typedef typename boost::detail::iterator_traits<Iterator>::pointer type; 44 }; 45 46 template <class Iterator> 47 struct iterator_difference 48 { 49 typedef typename boost::detail::iterator_traits<Iterator>::difference_type type; 50 }; 51 52 template <class Iterator> 53 struct BOOST_ITERATOR_CATEGORY 54 { 55 typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type; 56 }; 57 58 # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) 59 template <> 60 struct iterator_value<int> 61 { 62 typedef void type; 63 }; 64 65 template <> 66 struct iterator_reference<int> 67 { 68 typedef void type; 69 }; 70 71 template <> 72 struct iterator_pointer<int> 73 { 74 typedef void type; 75 }; 76 77 template <> 78 struct iterator_difference<int> 79 { 80 typedef void type; 81 }; 82 83 template <> 84 struct BOOST_ITERATOR_CATEGORY<int> 85 { 86 typedef void type; 87 }; 88 # endif 89 90 } // namespace boost::iterator 91 92 #endif // ITERATOR_TRAITS_DWA200347_HPP 93