mutable_iterator.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif
  15. #include <boost/range/config.hpp>
  16. #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  17. #include <boost/range/detail/iterator.hpp>
  18. #else
  19. #include <boost/iterator/iterator_traits.hpp>
  20. #include <cstddef>
  21. #include <utility>
  22. namespace boost
  23. {
  24. //////////////////////////////////////////////////////////////////////////
  25. // default
  26. //////////////////////////////////////////////////////////////////////////
  27. template< typename C >
  28. struct range_mutable_iterator
  29. {
  30. typedef BOOST_DEDUCED_TYPENAME C::iterator type;
  31. };
  32. //////////////////////////////////////////////////////////////////////////
  33. // pair
  34. //////////////////////////////////////////////////////////////////////////
  35. template< typename Iterator >
  36. struct range_mutable_iterator< std::pair<Iterator,Iterator> >
  37. {
  38. typedef Iterator type;
  39. };
  40. //////////////////////////////////////////////////////////////////////////
  41. // array
  42. //////////////////////////////////////////////////////////////////////////
  43. template< typename T, std::size_t sz >
  44. struct range_mutable_iterator< T[sz] >
  45. {
  46. typedef T* type;
  47. };
  48. } // namespace boost
  49. #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  50. #endif