13 #ifndef TINYMPL_TRANSPOSE_HPP
14 #define TINYMPL_TRANSPOSE_HPP
16 #include <tinympl/variadic/all_of.hpp>
17 #include <tinympl/variadic/at.hpp>
18 #include <tinympl/as_sequence.hpp>
19 #include <tinympl/is_sequence.hpp>
20 #include <tinympl/sequence.hpp>
21 #include <tinympl/variadic/all_of.hpp>
22 #include <tinympl/size.hpp>
23 #include <tinympl/bind.hpp>
24 #include <tinympl/equal_to.hpp>
25 #include <tinympl/int.hpp>
26 #include <tinympl/at.hpp>
39 template <
class SequenceOfSequences,
40 template<
class ...>
class OutOuter =
41 as_sequence<SequenceOfSequences>::template rebind,
42 template<
class ...>
class OutInner =
43 as_sequence<typename at<0,SequenceOfSequences>::type>::
46 transpose< as_sequence_t<SequenceOfSequences>, OutOuter, OutInner > {};
48 template<
class ... Sequences,
49 template<
class ...>
class OutOuter,
50 template<
class ...>
class OutInner>
53 "transpose: not all the elements of the main sequence are sequences" );
55 static_assert(
sizeof...( Sequences ) > 0,
56 "transpose is undefined on empty sequences" );
61 static_assert( variadic::all_of <
62 bind < equal_to, int_<size>,
63 bind<tinympl::size, arg1> >::
64 template eval, Sequences...>::value,
65 "transpose: all the sequences must have the same size" );
67 template<std::size_t i,
class ... Bound>
69 typedef OutInner<
typename at<i-1, Sequences>::type ... > cur_t;
70 typedef typename impl < i - 1, cur_t, Bound...>::type type;
73 template<
class ... Bound>
74 struct impl<0, Bound...> {
75 typedef OutOuter<Bound...> type;
79 typedef typename impl<size>::type type;
84 #endif // TINYMPL_TRANSPOSE_HPP
Determines whether every element in the sequence satisfies the given predicate.
Definition: all_of.hpp:31
Extract the i-th element of a variadic template.
Definition: at.hpp:27
Transpose a sequence of sequences.
Definition: transpose.hpp:45
Get the number of elements of a sequence.
Definition: size.hpp:27
The main sequence type.
Definition: sequence.hpp:28