iterator_traits.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. # include <boost/detail/workaround.hpp>
  8. #include <iterator>
  9. namespace boost {
  10. namespace iterators {
  11. // Macro for supporting old compilers, no longer needed but kept
  12. // for backwards compatibility (it was documented).
  13. #define BOOST_ITERATOR_CATEGORY iterator_category
  14. template <class Iterator>
  15. struct iterator_value
  16. {
  17. typedef typename std::iterator_traits<Iterator>::value_type type;
  18. };
  19. template <class Iterator>
  20. struct iterator_reference
  21. {
  22. typedef typename std::iterator_traits<Iterator>::reference type;
  23. };
  24. template <class Iterator>
  25. struct iterator_pointer
  26. {
  27. typedef typename std::iterator_traits<Iterator>::pointer type;
  28. };
  29. template <class Iterator>
  30. struct iterator_difference
  31. {
  32. typedef typename std::iterator_traits<Iterator>::difference_type type;
  33. };
  34. template <class Iterator>
  35. struct iterator_category
  36. {
  37. typedef typename std::iterator_traits<Iterator>::iterator_category type;
  38. };
  39. } // namespace iterators
  40. using iterators::iterator_value;
  41. using iterators::iterator_reference;
  42. using iterators::iterator_pointer;
  43. using iterators::iterator_difference;
  44. using iterators::iterator_category;
  45. } // namespace boost
  46. #endif // ITERATOR_TRAITS_DWA200347_HPP