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