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