Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 952 Bytes

Rotate.md

File metadata and controls

32 lines (25 loc) · 952 Bytes

<CppML/Algorithm/Rotate.hpp>

Rotate

template <int First, int Middle, int Last, typename Pipe = ml::ToList>
struct Rotate {
  template <typename ...Ts>
  using f = /* .... */;
};

Rotate<First, Middle, Last, Pipe>

Rotate<First, Middle, Last, Pipe> is a metafunction that passes to Pipe the parameter pack Us... which is the parameter pack Ts... which was been rotated around the Middle-th element. This makes Middle-th element the first element in Us.... Pipe defaults to ml::ToList.

f:: First ... Middle ... Last -> Middle ... Last, First .... >-> Pipe

Example

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