mutable_iterator.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_MUTABLE_ITERATOR_HPP
  11. #define BOOST_RANGE_MUTABLE_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/detail/extract_optional_type.hpp>
  18. #include <boost/type_traits/remove_reference.hpp>
  19. #include <boost/iterator/iterator_traits.hpp>
  20. #include <cstddef>
  21. #include <utility>
  22. namespace boost
  23. {
  24. //////////////////////////////////////////////////////////////////////////
  25. // default
  26. //////////////////////////////////////////////////////////////////////////
  27. namespace range_detail
  28. {
  29. BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( iterator )
  30. template< typename C >
  31. struct range_mutable_iterator
  32. : range_detail::extract_iterator<
  33. BOOST_DEDUCED_TYPENAME remove_reference<C>::type>
  34. {};
  35. //////////////////////////////////////////////////////////////////////////
  36. // pair
  37. //////////////////////////////////////////////////////////////////////////
  38. template< typename Iterator >
  39. struct range_mutable_iterator< std::pair<Iterator,Iterator> >
  40. {
  41. typedef Iterator type;
  42. };
  43. //////////////////////////////////////////////////////////////////////////
  44. // array
  45. //////////////////////////////////////////////////////////////////////////
  46. template< typename T, std::size_t sz >
  47. struct range_mutable_iterator< T[sz] >
  48. {
  49. typedef T* type;
  50. };
  51. } // namespace range_detail
  52. template<typename C, typename Enabler=void>
  53. struct range_mutable_iterator
  54. : range_detail::range_mutable_iterator<
  55. BOOST_DEDUCED_TYPENAME remove_reference<C>::type
  56. >
  57. {
  58. };
  59. } // namespace boost
  60. #include <boost/range/detail/msvc_has_iterator_workaround.hpp>
  61. #endif