13 #ifndef TINYMPL_VARIADIC_SORT_HPP
14 #define TINYMPL_VARIADIC_SORT_HPP
16 #include <tinympl/variadic/min_element.hpp>
17 #include <tinympl/variadic/erase.hpp>
18 #include <tinympl/variadic/at.hpp>
38 template<
template<
class ... >
class Cmp,
39 template<class ...> class Out,
40 class ... Args> struct
sort;
42 template<
template<
class ... >
class Comp,
43 template<class ...> class Out,
47 template<
class ... OtherArgs>
50 enum {this_min =
min_element<Comp, Args...>::type::value };
51 typedef typename erase < this_min, this_min + 1, next_sort, Args ... >::type
54 template<
class ... CopiedElements>
56 typedef typename next::template impl<CopiedElements...,
57 typename at<this_min, Args...>::type
61 template<
template<
class ... > class ,
template<
class ...>
class,
class ...>
65 typedef typename impl<>::type type;
68 template<
template<
class ... >
class Comp, template<class ...> class Out>
69 struct sort<Comp, Out> {
71 template<
class ... CopiedElements>
73 typedef Out<CopiedElements...> type;
76 template<
template<
class ... > class ,
template<
class ...>
class,
class ...>
80 typedef typename impl<>::type type;
86 #endif // TINYMPL_VARIADIC_SORT_HPP
Sort the input sequence according to a given comparison function.
Definition: sort.hpp:41
Extract the i-th element of a variadic template.
Definition: at.hpp:27
Sort the input sequence according to a given comparison function.
Definition: sort.hpp:40
Compute the index of the smallest element in a sequence.
Definition: min_element.hpp:35
Produce an output sequence from a variadic template by removin the elements in the given range...
Definition: erase.hpp:30