iterator.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include <boost/mpl/if.hpp>
  23. namespace boost
  24. {
  25. #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
  26. namespace range_detail_vc7_1
  27. {
  28. template< typename C, typename Sig = void(C) >
  29. struct range_iterator
  30. {
  31. typedef BOOST_RANGE_DEDUCED_TYPENAME
  32. mpl::eval_if_c< is_const<C>::value,
  33. range_const_iterator< typename remove_const<C>::type >,
  34. range_mutable_iterator<C> >::type type;
  35. };
  36. template< typename C, typename T >
  37. struct range_iterator< C, void(T[]) >
  38. {
  39. typedef T* type;
  40. };
  41. }
  42. template< typename C, typename Enabler=void >
  43. struct range_iterator
  44. {
  45. typedef BOOST_RANGE_DEDUCED_TYPENAME
  46. range_detail_vc7_1::range_iterator<C>::type type;
  47. };
  48. #else
  49. template< typename C, typename Enabler=void >
  50. struct range_iterator
  51. : mpl::if_c<
  52. is_const<typename remove_reference<C>::type>::value,
  53. range_const_iterator<typename remove_const<typename remove_reference<C>::type>::type>,
  54. range_mutable_iterator<typename remove_reference<C>::type>
  55. >::type
  56. {
  57. };
  58. #endif
  59. } // namespace boost
  60. #endif