iterator.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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