Imported Upstream version 0.8~alpha1
[platform/upstream/syncevolution.git] / src / boost / range / const_iterator.hpp
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
11 #ifndef BOOST_RANGE_CONST_ITERATOR_HPP
12 #define BOOST_RANGE_CONST_ITERATOR_HPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif
17
18 #include <boost/range/config.hpp>
19
20 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
21 #include <boost/range/detail/const_iterator.hpp>
22 #else
23
24 #include <cstddef>
25 #include <utility>
26
27 namespace boost
28 {
29     //////////////////////////////////////////////////////////////////////////
30     // default
31     //////////////////////////////////////////////////////////////////////////
32     
33     template< typename C >
34     struct range_const_iterator
35     {
36         typedef BOOST_DEDUCED_TYPENAME C::const_iterator type;
37     };
38     
39     //////////////////////////////////////////////////////////////////////////
40     // pair
41     //////////////////////////////////////////////////////////////////////////
42
43     template< typename Iterator >
44     struct range_const_iterator< std::pair<Iterator,Iterator> >
45     {
46         typedef Iterator type;
47     };
48     
49     template< typename Iterator >
50     struct range_const_iterator< const std::pair<Iterator,Iterator> >
51     {
52         typedef Iterator type;
53     };
54
55     //////////////////////////////////////////////////////////////////////////
56     // array
57     //////////////////////////////////////////////////////////////////////////
58
59     template< typename T, std::size_t sz >
60     struct range_const_iterator< T[sz] >
61     {
62         typedef const T* type;
63     };
64
65     template< typename T, std::size_t sz >
66     struct range_const_iterator< const T[sz] >
67     {
68         typedef const T* type;
69     };
70
71     //////////////////////////////////////////////////////////////////////////
72     // string
73     //////////////////////////////////////////////////////////////////////////
74
75     template<>
76     struct range_const_iterator< char* >
77     {
78         typedef const char* type;
79     };
80
81     template<>
82     struct range_const_iterator< wchar_t* >
83     {
84         typedef const wchar_t* type;
85     };
86
87     template<>
88     struct range_const_iterator< const char* >
89     {
90         typedef const char* type;
91     };
92
93     template<>
94     struct range_const_iterator< const wchar_t* >
95     {
96         typedef const wchar_t* type;
97     };
98
99     template<>
100     struct range_const_iterator< char* const >
101     {
102         typedef const char* type;
103     };
104
105     template<>
106     struct range_const_iterator< wchar_t* const >
107     {
108         typedef const wchar_t* type;
109     };
110
111     template<>
112     struct range_const_iterator< const char* const >
113     {
114         typedef const char* type;
115     };
116
117     template<>
118     struct range_const_iterator< const wchar_t* const >
119     {
120         typedef const wchar_t* type;
121     };
122
123 } // namespace boost
124
125 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
126
127 #endif