iterator.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_ITERATOR_HPP
  11. #define BOOST_RANGE_DETAIL_ITERATOR_HPP
  12. #include <boost/range/detail/common.hpp>
  13. #include <boost/range/detail/remove_extent.hpp>
  14. #include <boost/static_assert.hpp>
  15. //////////////////////////////////////////////////////////////////////////////
  16. // missing partial specialization workaround.
  17. //////////////////////////////////////////////////////////////////////////////
  18. namespace boost
  19. {
  20. namespace range_detail
  21. {
  22. template< typename T >
  23. struct range_iterator_ {
  24. template< typename C >
  25. struct pts
  26. {
  27. typedef int type;
  28. };
  29. };
  30. template<>
  31. struct range_iterator_<std_container_>
  32. {
  33. template< typename C >
  34. struct pts
  35. {
  36. typedef BOOST_RANGE_DEDUCED_TYPENAME C::iterator type;
  37. };
  38. };
  39. template<>
  40. struct range_iterator_<std_pair_>
  41. {
  42. template< typename P >
  43. struct pts
  44. {
  45. typedef BOOST_RANGE_DEDUCED_TYPENAME P::first_type type;
  46. };
  47. };
  48. template<>
  49. struct range_iterator_<array_>
  50. {
  51. template< typename T >
  52. struct pts
  53. {
  54. typedef BOOST_RANGE_DEDUCED_TYPENAME
  55. remove_extent<T>::type* type;
  56. };
  57. };
  58. }
  59. template< typename C >
  60. class range_mutable_iterator
  61. {
  62. typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
  63. public:
  64. typedef typename range_detail::range_iterator_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
  65. };
  66. }
  67. #endif