Chris@16
|
1 // Boost.Range library
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
Chris@16
|
4 // distribution is subject to the Boost Software License, Version
|
Chris@16
|
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 //
|
Chris@16
|
8 // For more information, see http://www.boost.org/libs/range/
|
Chris@16
|
9 //
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_RANGE_CONST_ITERATOR_HPP
|
Chris@16
|
12 #define BOOST_RANGE_CONST_ITERATOR_HPP
|
Chris@16
|
13
|
Chris@101
|
14 #if defined(_MSC_VER)
|
Chris@16
|
15 # pragma once
|
Chris@16
|
16 #endif
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/range/config.hpp>
|
Chris@16
|
19
|
Chris@101
|
20 #include <boost/range/range_fwd.hpp>
|
Chris@16
|
21 #include <boost/range/detail/extract_optional_type.hpp>
|
Chris@16
|
22 #include <boost/type_traits/remove_const.hpp>
|
Chris@101
|
23 #include <boost/type_traits/remove_reference.hpp>
|
Chris@16
|
24 #include <cstddef>
|
Chris@16
|
25 #include <utility>
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost
|
Chris@16
|
28 {
|
Chris@16
|
29 //////////////////////////////////////////////////////////////////////////
|
Chris@16
|
30 // default
|
Chris@16
|
31 //////////////////////////////////////////////////////////////////////////
|
Chris@16
|
32
|
Chris@101
|
33 namespace range_detail
|
Chris@101
|
34 {
|
Chris@16
|
35
|
Chris@101
|
36 BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator )
|
Chris@16
|
37
|
Chris@101
|
38 template< typename C >
|
Chris@101
|
39 struct range_const_iterator
|
Chris@101
|
40 : extract_const_iterator<C>
|
Chris@101
|
41 {};
|
Chris@16
|
42
|
Chris@101
|
43 //////////////////////////////////////////////////////////////////////////
|
Chris@101
|
44 // pair
|
Chris@101
|
45 //////////////////////////////////////////////////////////////////////////
|
Chris@101
|
46
|
Chris@101
|
47 template< typename Iterator >
|
Chris@101
|
48 struct range_const_iterator<std::pair<Iterator,Iterator> >
|
Chris@101
|
49 {
|
Chris@101
|
50 typedef Iterator type;
|
Chris@101
|
51 };
|
Chris@101
|
52
|
Chris@101
|
53 //////////////////////////////////////////////////////////////////////////
|
Chris@101
|
54 // array
|
Chris@101
|
55 //////////////////////////////////////////////////////////////////////////
|
Chris@101
|
56
|
Chris@101
|
57 template< typename T, std::size_t sz >
|
Chris@101
|
58 struct range_const_iterator< T[sz] >
|
Chris@101
|
59 {
|
Chris@101
|
60 typedef const T* type;
|
Chris@101
|
61 };
|
Chris@101
|
62
|
Chris@101
|
63 } // namespace range_detail
|
Chris@101
|
64
|
Chris@101
|
65 template<typename C, typename Enabler=void>
|
Chris@101
|
66 struct range_const_iterator
|
Chris@101
|
67 : range_detail::range_const_iterator<
|
Chris@101
|
68 BOOST_DEDUCED_TYPENAME remove_reference<C>::type
|
Chris@101
|
69 >
|
Chris@101
|
70 {
|
Chris@101
|
71 };
|
Chris@16
|
72
|
Chris@16
|
73 } // namespace boost
|
Chris@16
|
74
|
Chris@16
|
75
|
Chris@16
|
76 #endif
|