File indexing completed on 2024-11-16 09:34:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef BOOST_THREAD_DETAIL_MAKE_TUPLE_INDICES_HPP
0022 #define BOOST_THREAD_DETAIL_MAKE_TUPLE_INDICES_HPP
0023
0024 #include <boost/config.hpp>
0025 #include <boost/static_assert.hpp>
0026
0027 namespace boost
0028 {
0029 namespace detail
0030 {
0031
0032 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0033
0034
0035 template <std::size_t...> struct tuple_indices
0036 {};
0037
0038 template <std::size_t Sp, class IntTuple, std::size_t Ep>
0039 struct make_indices_imp;
0040
0041 template <std::size_t Sp, std::size_t ...Indices, std::size_t Ep>
0042 struct make_indices_imp<Sp, tuple_indices<Indices...>, Ep>
0043 {
0044 typedef typename make_indices_imp<Sp+1, tuple_indices<Indices..., Sp>, Ep>::type type;
0045 };
0046
0047 template <std::size_t Ep, std::size_t ...Indices>
0048 struct make_indices_imp<Ep, tuple_indices<Indices...>, Ep>
0049 {
0050 typedef tuple_indices<Indices...> type;
0051 };
0052
0053 template <std::size_t Ep, std::size_t Sp = 0>
0054 struct make_tuple_indices
0055 {
0056 BOOST_STATIC_ASSERT_MSG(Sp <= Ep, "make_tuple_indices input error");
0057 typedef typename make_indices_imp<Sp, tuple_indices<>, Ep>::type type;
0058 };
0059 #else
0060
0061
0062 template <
0063 std::size_t T0 = 0, std::size_t T1 = 0, std::size_t T2 = 0,
0064 std::size_t T3 = 0, std::size_t T4 = 0, std::size_t T5 = 0,
0065 std::size_t T6 = 0, std::size_t T7 = 0, std::size_t T8 = 0,
0066 std::size_t T9 = 0>
0067 class tuple_indices {};
0068
0069 template <std::size_t Sp, class IntTuple, std::size_t Ep>
0070 struct make_indices_imp;
0071
0072 template <std::size_t Sp, std::size_t Ep>
0073 struct make_indices_imp<Sp, tuple_indices<>, Ep>
0074 {
0075 typedef typename make_indices_imp<Sp+1, tuple_indices<Sp>, Ep>::type type;
0076 };
0077 template <std::size_t Sp, std::size_t I0, std::size_t Ep>
0078 struct make_indices_imp<Sp, tuple_indices<I0>, Ep>
0079 {
0080 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, Sp>, Ep>::type type;
0081 };
0082 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t Ep>
0083 struct make_indices_imp<Sp, tuple_indices<I0, I1>, Ep>
0084 {
0085 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, Sp>, Ep>::type type;
0086 };
0087 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t Ep>
0088 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2>, Ep>
0089 {
0090 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, Sp>, Ep>::type type;
0091 };
0092 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t Ep>
0093 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3>, Ep>
0094 {
0095 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, Sp>, Ep>::type type;
0096 };
0097 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t Ep>
0098 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3, I4>, Ep>
0099 {
0100 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, I4, Sp>, Ep>::type type;
0101 };
0102 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5, std::size_t Ep>
0103 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3, I4, I5>, Ep>
0104 {
0105 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, I4, I5, Sp>, Ep>::type type;
0106 };
0107 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0108 , std::size_t I6
0109 , std::size_t Ep>
0110 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3, I4, I5, I6>, Ep>
0111 {
0112 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, I4, I5, I6, Sp>, Ep>::type type;
0113 };
0114 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0115 , std::size_t I6
0116 , std::size_t I7
0117 , std::size_t Ep>
0118 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3, I4, I5, I6, I7>, Ep>
0119 {
0120 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, Sp>, Ep>::type type;
0121 };
0122 template <std::size_t Sp, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0123 , std::size_t I6
0124 , std::size_t I7
0125 , std::size_t I8
0126 , std::size_t Ep>
0127 struct make_indices_imp<Sp, tuple_indices<I0, I1 , I2, I3, I4, I5, I6, I7, I8>, Ep>
0128 {
0129 typedef typename make_indices_imp<Sp+1, tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, I8, Sp>, Ep>::type type;
0130 };
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142 template <std::size_t Ep>
0143 struct make_indices_imp<Ep, tuple_indices<>, Ep>
0144 {
0145 typedef tuple_indices<> type;
0146 };
0147 template <std::size_t Ep, std::size_t I0>
0148 struct make_indices_imp<Ep, tuple_indices<I0>, Ep>
0149 {
0150 typedef tuple_indices<I0> type;
0151 };
0152 template <std::size_t Ep, std::size_t I0, std::size_t I1>
0153 struct make_indices_imp<Ep, tuple_indices<I0, I1>, Ep>
0154 {
0155 typedef tuple_indices<I0, I1> type;
0156 };
0157 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2>
0158 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2>, Ep>
0159 {
0160 typedef tuple_indices<I0, I1, I2> type;
0161 };
0162 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3>
0163 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3>, Ep>
0164 {
0165 typedef tuple_indices<I0, I1, I2, I3> type;
0166 };
0167 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4>
0168 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4>, Ep>
0169 {
0170 typedef tuple_indices<I0, I1, I2, I3, I4> type;
0171 };
0172 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5>
0173 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4, I5>, Ep>
0174 {
0175 typedef tuple_indices<I0, I1, I2, I3, I4, I5> type;
0176 };
0177 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0178 , std::size_t I6
0179 >
0180 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4, I5, I6>, Ep>
0181 {
0182 typedef tuple_indices<I0, I1, I2, I3, I4, I5, I6> type;
0183 };
0184 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0185 , std::size_t I6
0186 , std::size_t I7
0187 >
0188 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7>, Ep>
0189 {
0190 typedef tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7> type;
0191 };
0192 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0193 , std::size_t I6
0194 , std::size_t I7
0195 , std::size_t I8
0196 >
0197 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, I8>, Ep>
0198 {
0199 typedef tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, I8> type;
0200 };
0201
0202 template <std::size_t Ep, std::size_t I0, std::size_t I1, std::size_t I2, std::size_t I3, std::size_t I4, std::size_t I5
0203 , std::size_t I6
0204 , std::size_t I7
0205 , std::size_t I8
0206 , std::size_t I9
0207 >
0208 struct make_indices_imp<Ep, tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, I8, I9>, Ep>
0209 {
0210 typedef tuple_indices<I0, I1, I2, I3, I4, I5, I6, I7, I8, I9> type;
0211 };
0212
0213 template <std::size_t Ep, std::size_t Sp = 0>
0214 struct make_tuple_indices
0215 {
0216 BOOST_STATIC_ASSERT_MSG(Sp <= Ep, "make_tuple_indices input error");
0217 typedef typename make_indices_imp<Sp, tuple_indices<>, Ep>::type type;
0218 };
0219
0220 #endif
0221 }
0222 }
0223
0224 #endif