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)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_CONST_ITERATOR_HPP
12 #define BOOST_RANGE_CONST_ITERATOR_HPP
18 #include <boost/range/config.hpp>
20 #include <boost/range/range_fwd.hpp>
21 #include <boost/range/detail/extract_optional_type.hpp>
22 #include <boost/type_traits/remove_const.hpp>
23 #include <boost/type_traits/remove_reference.hpp>
29 //////////////////////////////////////////////////////////////////////////
31 //////////////////////////////////////////////////////////////////////////
33 namespace range_detail
36 BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator )
38 template< typename C >
39 struct range_const_iterator_helper
40 : extract_const_iterator<C>
43 //////////////////////////////////////////////////////////////////////////
45 //////////////////////////////////////////////////////////////////////////
47 template< typename Iterator >
48 struct range_const_iterator_helper<std::pair<Iterator,Iterator> >
50 typedef Iterator type;
53 //////////////////////////////////////////////////////////////////////////
55 //////////////////////////////////////////////////////////////////////////
57 template< typename T, std::size_t sz >
58 struct range_const_iterator_helper< T[sz] >
60 typedef const T* type;
63 } // namespace range_detail
65 template<typename C, typename Enabler=void>
66 struct range_const_iterator
67 : range_detail::range_const_iterator_helper<
68 BOOST_DEDUCED_TYPENAME remove_reference<C>::type