Chris@16
|
1 // Boost.Range library
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright Jonathan Turkanis 2005. 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
|
Chris@16
|
12 #ifndef BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
|
Chris@16
|
13 #define BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
|
Chris@16
|
14
|
Chris@16
|
15 #include <boost/config.hpp> // MSVC, NO_INTRINSIC_WCHAR_T, put size_t in std.
|
Chris@16
|
16 #include <cstddef>
|
Chris@16
|
17 #include <boost/mpl/eval_if.hpp>
|
Chris@16
|
18 #include <boost/mpl/identity.hpp>
|
Chris@16
|
19 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost
|
Chris@16
|
22 {
|
Chris@16
|
23 namespace range_detail
|
Chris@16
|
24 {
|
Chris@16
|
25
|
Chris@16
|
26 template< typename Case1 = mpl::true_,
|
Chris@16
|
27 typename Type1 = mpl::void_,
|
Chris@16
|
28 typename Case2 = mpl::true_,
|
Chris@16
|
29 typename Type2 = mpl::void_,
|
Chris@16
|
30 typename Case3 = mpl::true_,
|
Chris@16
|
31 typename Type3 = mpl::void_,
|
Chris@16
|
32 typename Case4 = mpl::true_,
|
Chris@16
|
33 typename Type4 = mpl::void_,
|
Chris@16
|
34 typename Case5 = mpl::true_,
|
Chris@16
|
35 typename Type5 = mpl::void_,
|
Chris@16
|
36 typename Case6 = mpl::true_,
|
Chris@16
|
37 typename Type6 = mpl::void_,
|
Chris@16
|
38 typename Case7 = mpl::true_,
|
Chris@16
|
39 typename Type7 = mpl::void_,
|
Chris@16
|
40 typename Case8 = mpl::true_,
|
Chris@16
|
41 typename Type8 = mpl::void_,
|
Chris@16
|
42 typename Case9 = mpl::true_,
|
Chris@16
|
43 typename Type9 = mpl::void_,
|
Chris@16
|
44 typename Case10 = mpl::true_,
|
Chris@16
|
45 typename Type10 = mpl::void_,
|
Chris@16
|
46 typename Case11 = mpl::true_,
|
Chris@16
|
47 typename Type11 = mpl::void_,
|
Chris@16
|
48 typename Case12 = mpl::true_,
|
Chris@16
|
49 typename Type12 = mpl::void_,
|
Chris@16
|
50 typename Case13 = mpl::true_,
|
Chris@16
|
51 typename Type13 = mpl::void_,
|
Chris@16
|
52 typename Case14 = mpl::true_,
|
Chris@16
|
53 typename Type14 = mpl::void_,
|
Chris@16
|
54 typename Case15 = mpl::true_,
|
Chris@16
|
55 typename Type15 = mpl::void_,
|
Chris@16
|
56 typename Case16 = mpl::true_,
|
Chris@16
|
57 typename Type16 = mpl::void_,
|
Chris@16
|
58 typename Case17 = mpl::true_,
|
Chris@16
|
59 typename Type17 = mpl::void_,
|
Chris@16
|
60 typename Case18 = mpl::true_,
|
Chris@16
|
61 typename Type18 = mpl::void_,
|
Chris@16
|
62 typename Case19 = mpl::true_,
|
Chris@16
|
63 typename Type19 = mpl::void_,
|
Chris@16
|
64 typename Case20 = mpl::true_,
|
Chris@16
|
65 typename Type20 = mpl::void_>
|
Chris@16
|
66 struct select {
|
Chris@16
|
67 typedef typename
|
Chris@16
|
68 mpl::eval_if<
|
Chris@16
|
69 Case1, mpl::identity<Type1>, mpl::eval_if<
|
Chris@16
|
70 Case2, mpl::identity<Type2>, mpl::eval_if<
|
Chris@16
|
71 Case3, mpl::identity<Type3>, mpl::eval_if<
|
Chris@16
|
72 Case4, mpl::identity<Type4>, mpl::eval_if<
|
Chris@16
|
73 Case5, mpl::identity<Type5>, mpl::eval_if<
|
Chris@16
|
74 Case6, mpl::identity<Type6>, mpl::eval_if<
|
Chris@16
|
75 Case7, mpl::identity<Type7>, mpl::eval_if<
|
Chris@16
|
76 Case8, mpl::identity<Type8>, mpl::eval_if<
|
Chris@16
|
77 Case9, mpl::identity<Type9>, mpl::if_<
|
Chris@16
|
78 Case10, Type10, mpl::void_ > > > > > > > > >
|
Chris@16
|
79 >::type result1;
|
Chris@16
|
80 typedef typename
|
Chris@16
|
81 mpl::eval_if<
|
Chris@16
|
82 Case11, mpl::identity<Type11>, mpl::eval_if<
|
Chris@16
|
83 Case12, mpl::identity<Type12>, mpl::eval_if<
|
Chris@16
|
84 Case13, mpl::identity<Type13>, mpl::eval_if<
|
Chris@16
|
85 Case14, mpl::identity<Type14>, mpl::eval_if<
|
Chris@16
|
86 Case15, mpl::identity<Type15>, mpl::eval_if<
|
Chris@16
|
87 Case16, mpl::identity<Type16>, mpl::eval_if<
|
Chris@16
|
88 Case17, mpl::identity<Type17>, mpl::eval_if<
|
Chris@16
|
89 Case18, mpl::identity<Type18>, mpl::eval_if<
|
Chris@16
|
90 Case19, mpl::identity<Type19>, mpl::if_<
|
Chris@16
|
91 Case20, Type20, mpl::void_ > > > > > > > > >
|
Chris@16
|
92 > result2;
|
Chris@16
|
93 typedef typename
|
Chris@16
|
94 mpl::eval_if<
|
Chris@16
|
95 is_same<result1, mpl::void_>,
|
Chris@16
|
96 result2,
|
Chris@16
|
97 mpl::identity<result1>
|
Chris@16
|
98 >::type type;
|
Chris@16
|
99 };
|
Chris@16
|
100
|
Chris@16
|
101 template<typename T>
|
Chris@16
|
102 struct remove_extent {
|
Chris@16
|
103 static T* ar;
|
Chris@16
|
104 BOOST_STATIC_CONSTANT(std::size_t, size = sizeof(*ar) / sizeof((*ar)[0]));
|
Chris@16
|
105
|
Chris@16
|
106 typedef typename
|
Chris@16
|
107 select<
|
Chris@16
|
108 is_same<T, bool[size]>, bool,
|
Chris@16
|
109 is_same<T, char[size]>, char,
|
Chris@16
|
110 is_same<T, signed char[size]>, signed char,
|
Chris@16
|
111 is_same<T, unsigned char[size]>, unsigned char,
|
Chris@16
|
112 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
Chris@16
|
113 is_same<T, wchar_t[size]>, wchar_t,
|
Chris@16
|
114 #endif
|
Chris@16
|
115 is_same<T, short[size]>, short,
|
Chris@16
|
116 is_same<T, unsigned short[size]>, unsigned short,
|
Chris@16
|
117 is_same<T, int[size]>, int,
|
Chris@16
|
118 is_same<T, unsigned int[size]>, unsigned int,
|
Chris@16
|
119 is_same<T, long[size]>, long,
|
Chris@16
|
120 is_same<T, unsigned long[size]>, unsigned long,
|
Chris@16
|
121 is_same<T, float[size]>, float,
|
Chris@16
|
122 is_same<T, double[size]>, double,
|
Chris@16
|
123 is_same<T, long double[size]>, long double
|
Chris@16
|
124 >::type result1;
|
Chris@16
|
125 typedef typename
|
Chris@16
|
126 select<
|
Chris@16
|
127 is_same<T, const bool[size]>, const bool,
|
Chris@16
|
128 is_same<T, const char[size]>, const char,
|
Chris@16
|
129 is_same<T, const signed char[size]>, const signed char,
|
Chris@16
|
130 is_same<T, const unsigned char[size]>, const unsigned char,
|
Chris@16
|
131 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
Chris@16
|
132 is_same<T, const wchar_t[size]>, const wchar_t,
|
Chris@16
|
133 #endif
|
Chris@16
|
134 is_same<T, const short[size]>, const short,
|
Chris@16
|
135 is_same<T, const unsigned short[size]>, const unsigned short,
|
Chris@16
|
136 is_same<T, const int[size]>, const int,
|
Chris@16
|
137 is_same<T, const unsigned int[size]>, const unsigned int,
|
Chris@16
|
138 is_same<T, const long[size]>, const long,
|
Chris@16
|
139 is_same<T, const unsigned long[size]>, const unsigned long,
|
Chris@16
|
140 is_same<T, const float[size]>, const float,
|
Chris@16
|
141 is_same<T, const double[size]>, const double,
|
Chris@16
|
142 is_same<T, const long double[size]>, const long double
|
Chris@16
|
143 > result2;
|
Chris@16
|
144 typedef typename
|
Chris@16
|
145 mpl::eval_if<
|
Chris@16
|
146 is_same<result1, mpl::void_>,
|
Chris@16
|
147 result2,
|
Chris@16
|
148 mpl::identity<result1>
|
Chris@16
|
149 >::type type;
|
Chris@16
|
150 };
|
Chris@16
|
151
|
Chris@16
|
152 } // namespace 'range_detail'
|
Chris@16
|
153
|
Chris@16
|
154 } // namespace 'boost'
|
Chris@16
|
155
|
Chris@16
|
156
|
Chris@16
|
157 #endif
|