const_iterator.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Boost.Range library
  2. //
  3. // Copyright Thorsten Ottosen 2003-2004. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/range/
  9. //
  10. #ifndef BOOST_RANGE_DETAIL_CONST_ITERATOR_HPP
  11. #define BOOST_RANGE_DETAIL_CONST_ITERATOR_HPP
  12. #include <boost/range/detail/common.hpp>
  13. #include <boost/range/detail/remove_extent.hpp>
  14. //////////////////////////////////////////////////////////////////////////////
  15. // missing partial specialization workaround.
  16. //////////////////////////////////////////////////////////////////////////////
  17. namespace boost
  18. {
  19. namespace range_detail
  20. {
  21. template< typename T >
  22. struct range_const_iterator_;
  23. template<>
  24. struct range_const_iterator_<std_container_>
  25. {
  26. template< typename C >
  27. struct pts
  28. {
  29. typedef BOOST_RANGE_DEDUCED_TYPENAME C::const_iterator type;
  30. };
  31. };
  32. template<>
  33. struct range_const_iterator_<std_pair_>
  34. {
  35. template< typename P >
  36. struct pts
  37. {
  38. typedef BOOST_RANGE_DEDUCED_TYPENAME P::first_type type;
  39. };
  40. };
  41. template<>
  42. struct range_const_iterator_<array_>
  43. {
  44. template< typename T >
  45. struct pts
  46. {
  47. typedef const BOOST_RANGE_DEDUCED_TYPENAME
  48. remove_extent<T>::type* type;
  49. };
  50. };
  51. }
  52. template< typename C >
  53. class range_const_iterator
  54. {
  55. typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
  56. public:
  57. typedef BOOST_DEDUCED_TYPENAME range_detail::range_const_iterator_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
  58. };
  59. }
  60. #endif