iterator.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_ITERATOR_HPP
  11. #define BOOST_RANGE_ITERATOR_HPP
  12. #if defined(_MSC_VER)
  13. # pragma once
  14. #endif
  15. #include <boost/range/config.hpp>
  16. #include <boost/range/range_fwd.hpp>
  17. #include <boost/range/mutable_iterator.hpp>
  18. #include <boost/range/const_iterator.hpp>
  19. #include <boost/type_traits/is_const.hpp>
  20. #include <boost/type_traits/remove_const.hpp>
  21. #include <boost/mpl/eval_if.hpp>
  22. namespace boost
  23. {
  24. #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
  25. namespace range_detail_vc7_1
  26. {
  27. template< typename C, typename Sig = void(C) >
  28. struct range_iterator
  29. {
  30. typedef BOOST_RANGE_DEDUCED_TYPENAME
  31. mpl::eval_if_c< is_const<C>::value,
  32. range_const_iterator< typename remove_const<C>::type >,
  33. range_mutable_iterator<C> >::type type;
  34. };
  35. template< typename C, typename T >
  36. struct range_iterator< C, void(T[]) >
  37. {
  38. typedef T* type;
  39. };
  40. }
  41. template< typename C, typename Enabler=void >
  42. struct range_iterator
  43. {
  44. typedef BOOST_RANGE_DEDUCED_TYPENAME
  45. range_detail_vc7_1::range_iterator<C>::type type;
  46. };
  47. #else
  48. template< typename C, typename Enabler=void >
  49. struct range_iterator
  50. : mpl::if_c<
  51. is_const<typename remove_reference<C>::type>::value,
  52. range_const_iterator<typename remove_const<typename remove_reference<C>::type>::type>,
  53. range_mutable_iterator<typename remove_reference<C>::type>
  54. >::type
  55. {
  56. };
  57. #endif
  58. } // namespace boost
  59. #endif