13 template <
size_t I,
typename T>
33 template <
typename S1,
typename S2>
struct concat;
35 template <std::size_t... I1, std::size_t... I2>
39 template <
typename S1,
typename S2>
43 template <std::
size_t N>
using GenSeq =
46 template <std::
size_t N>
52 template <std::
size_t off,
typename S2>
struct int_range;
54 template <std::size_t off, std::size_t... I>
67 template <std::
size_t S, std::
size_t L>
69 :
int_range<S, typename make_index_sequence<L>::type>
73 template <std::
size_t S>
75 template <std::
size_t S>
82 template <std::
size_t S, std::
size_t E>
87 template <std::
size_t S, std::
size_t E>
92 template <
typename S1,
typename S2>
95 template <std::size_t... I1, std::size_t... I2>
99 template <
typename S1,
typename S2>
113 template <
typename S1,
typename S2>
116 template <std::size_t I1_1, std::size_t... I1, std::size_t... I2>
125 template <std::size_t I1_1, std::size_t I2_1,
126 std::size_t... I1, std::size_t... I2>
136 template <std::size_t I1_1, std::size_t... I1>
151 template <
typename S1,
typename S2>
156 template <
typename Fun,
typename... Ts>
158 for_(
const std::tuple<Ts...>& ts, Fun f)
163 template <
typename Fun,
typename... Ts,
size_t... I>
166 const std::tuple<Ts...>& ts,
169 using swallow =
int[];
170 (
void) swallow{ (f(std::get<I>(ts)), 0)... };
175 template <
typename Fun,
typename... Ts>
177 map(
const std::tuple<Ts...>& ts, Fun f)
183 template <
typename Fun,
typename... Ts,
size_t... I>
186 const std::tuple<Ts...>& ts,
189 return std::make_tuple(f(std::get<I>(ts))...);
194 template <
typename Fun,
typename... Args>
196 apply(Fun f,
const std::tuple<Args...>& args)
203 template <
typename Fun,
typename... Args,
size_t... I>
206 const std::tuple<Args...>& args,
209 -> decltype(f(std::get<I>(args)...))
211 return f(std::get<I>(args)...);
217 template <
typename... Funs,
typename... Args>
219 apply(
const std::tuple<Funs...>& funs,
const std::tuple<Args...>& args)
221 static_assert(
sizeof...(Funs) ==
sizeof...(Args),
222 "tuples of functions and arguments of different sizes");
228 template <
typename... Funs,
typename... Args,
size_t... I>
231 const std::tuple<Args...>& args,
234 return std::make_tuple(std::get<I>(funs)(std::get<I>(args))...);
240 template <
typename Fun,
typename... Objs,
typename... Args>
243 const std::tuple<Objs...>& objs,
const std::tuple<Args...>& args)
245 static_assert(
sizeof...(Objs) ==
sizeof...(Args),
246 "tuples of objects and arguments of different sizes");
251 template <
typename Fun,
typename... Objs,
typename... Args,
size_t... I>
254 const std::tuple<Objs...>& objs,
255 const std::tuple<Args...>& args,
258 return std::make_tuple(fun(std::get<I>(objs), std::get<I>(args))...);
271 template <
typename Fun>
278 template <
typename Fun,
279 typename Cont,
typename... Conts>
282 const Cont& head,
const Conts&... tails)
284 for (
const typename Cont::value_type& h: head)
285 cross([&](
const typename Conts::value_type&... tails)
290 template <
typename Fun,
typename... Ts,
size_t... I>
293 const std::tuple<Ts...>& ts,
296 cross(f, std::get<I>(ts)...);
299 template <
typename Fun,
typename... Ts>
302 const std::tuple<Ts...>& ts)
313 template <
typename... Ts>
321 template <
typename... Ts, std::size_t... I>
324 -> decltype(std::make_tuple(std::get<
sizeof...(Ts) - 1 - I>(t)...))
326 return std::make_tuple(std::get<
sizeof...(Ts) - 1 - I>(t)...);
331 #if VCSN_HAVE_CORRECT_LIST_INITIALIZER_ORDER
332 template <
typename... Ts>
335 -> decltype(std::make_tuple(std::forward<Ts>(ts)...))
337 return std::make_tuple(std::forward<Ts>(ts)...);
340 template <
typename... Ts>
343 -> decltype(
reverse_tuple(std::make_tuple(std::forward<Ts>(ts)...)))
345 return reverse_tuple(std::make_tuple(std::forward<Ts>(ts)...));
354 template <
typename Tuple, std::
size_t N>
357 static void print(
const Tuple& t, std::ostream& o)
360 o <<
", " << std::get<N-1>(t);
364 template <
typename Tuple>
367 static void print(
const Tuple& t, std::ostream& o)
373 template <
typename... Args>
374 std::ostream&
print(
const std::tuple<Args...>& args, std::ostream& o)
387 template <
bool c,
typename T1,
typename T2>
390 template <
typename T1,
typename T2>
393 template <
typename C,
typename T1,
typename T2>
397 template <
bool c,
typename F1,
typename F2>
400 template <
typename C,
typename F1,
typename F2>
404 template <
typename... F>
407 template <
typename F1,
typename... F>
408 struct and_<F1, F...> :
eval_if<F1, and_<F...>, std::false_type>::type {};
410 template <
typename F1>
411 struct and_<F1> :
eval_if<F1, std::true_type, std::false_type>::type {};
417 template <
typename... F>
420 template <
typename F1,
typename... F>
421 struct or_<F1, F...> :
eval_if<F1, std::true_type, or_<F...>>::type { };
423 template <
typename F1>
424 struct or_<F1> :
eval_if<F1, std::true_type, std::false_type>::type { };
445 template <
typename... Bool>
446 bool all(Bool&&... values)
449 using swallow =
int[];
452 (res = res && values, 0)...
462 template <
typename... Bool>
466 using swallow =
int[];
469 (res = res || values, 0)...
483 template <
typename... Elements>
495 template <std::size_t... I>
500 using swallow =
int[];
typename concat_index_sequence< index_sequence< I1_1 >, typename index_sequence_difference< index_sequence< I1... >, index_sequence< I2_1, I2... >>::type >::type type
static void print(const Tuple &t, std::ostream &o)
static std::size_t hash_(const value_t &v, vcsn::detail::index_sequence< I... >)
typename concat_index_sequence< index_sequence< I1_1 >, typename index_sequence_difference< index_sequence< I1... >, index_sequence<>>::type >::type type
And condition on several typenames.
typename concat_index_sequence< S1, S2 >::type concat_sequence
auto map_impl_(Fun f, const std::tuple< Ts... > &ts, index_sequence< I... >)
ValueSet::value_t tuple(const ValueSet &vs, const typename ValueSets::value_t &...v)
bool all(Bool &&...values)
Whether all the values evaluate as true.
void cross_tuple(Fun f, const std::tuple< Ts... > &ts)
auto apply(Fun f, const std::tuple< Args... > &args) -> decltype(apply_impl_(f, args, make_index_sequence< sizeof...(Args)>()))
Unpack a tuple, and pass its content as argument to a funtion.
Or condition on several typenames.
auto reverse_tuple(const std::tuple< Ts... > &t) -> decltype(reverse_tuple(t, make_index_sequence< sizeof...(Ts)>()))
typename make_index_sequence< N >::type GenSeq
typename index_sequence_difference< typename S1::type, typename S2::type >::type sequence_difference
std::string type(const automaton &a)
The implementation type of a.
static void print(const Tuple &t, std::ostream &o)
constexpr bool any_()
Static evaluation of the 'or' of the template parameters.
auto make_gcc_tuple(Ts &&...ts) -> decltype(reverse_tuple(std::make_tuple(std::forward< Ts >(ts)...)))
Same as make_tuple, unless the evaluation of arguments if right-to-left, in which case reverse the re...
Test if (c) then F1 else F2 and get the value.
auto apply_impl_(Fun f, const std::tuple< Args... > &args, index_sequence< I... >) -> decltype(f(std::get< I >(args)...))
void for_(const std::tuple< Ts... > &ts, Fun f)
auto tuple(const Auts &...as)
Build the (accessible part of the) tuple.
auto map(const std::tuple< Ts... > &ts, Fun f) -> decltype(map_tuple_(f, ts, make_index_sequence< sizeof...(Ts)>()))
Map a function on a tuple, return tuple of the results.
std::size_t operator()(const value_t &v) const
void cross_tuple_(Fun f, const std::tuple< Ts... > &ts, index_sequence< I... >)
Get the list containing all the elements of I1 (contiguous sequence from 0 to N) not present in I2 (a...
typename make_index_range< S, E >::type make_index_range_t
typename index_sequence<>::type type
typename std::tuple_element< I, T >::type tuple_element_t
C++14.
bool operator()(Bool &&...values)
void hash_combine(std::size_t &seed, const T &v)
std::ostream & print(const std::tuple< Args... > &args, std::ostream &o)
void cross(Fun f)
Variadic Cartesian product of containers.
std::tuple< Elements... > value_t
typename index_sequence_difference< index_sequence< I1... >, index_sequence< I2... >>::type type
Whether some of the values evaluate as true.