Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 852 Bytes

Pivot.md

File metadata and controls

32 lines (25 loc) · 852 Bytes

<CppML/Algorithm/Pivot.hpp>

Pivot

template <int N, typename Pipe = ml::ToList>
struct Pivot {
  template <typename ...Ts>
  using f = /* .... */;
};

Pivot<N, Pipe>

Pivot<N, Pipe> is a metafunction that passes to Pipe the parameter pack Us... which is the parameter pack Ts... which was pivoted around N-th element (making N-th element the first element in Us...). Pipe defaults to ml::ToList.

f:: First ... N-th ... Last -> N-th ... Last, First .... >-> Pipe

Example

using T = ml::f<
                 ml::Pivot<2>,
                 ml::Int<0>, ml::Int<1>, ml::Int<2>, ml::Int<3>>;
static_assert(
              std::is_same_v<
                  T,
                  ml::ListT<
                      ml::Int<2>, ml::Int<3>, ml::Int<0>, ml::Int<1>>);