KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ rotate_left

template<std::size_t R>
rotate_left_t<R> kumi::rotate_left {}
inlineconstexprnodiscard

Callable object.

On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.

Header file

#include <kumi/algorithm/rotate.hpp>

Call Signature

template<std::size_t R, product_type T>
constexpr auto rotate_left<R>(T && t) ;
constexpr rotate_left_t< R > rotate_left
Callable object.
Definition rotate.hpp:93

Template Parameters

  • R: Rotation factor

Parameters

  • t: Product Type to rotate

Return value

  • A product type equivalent to t with elements rotated R positions to the left.

Helper type

template<std::size_t R, kumi::concepts::product_type T> struct rotate_left
{
using type = decltype(kumi::rotate_left<R>(std::declval<T>()));
};
template<std::size_t R, kumi::concepts::product_type T>
using rotate_left_t = typename kumi::result::rotate_left<R, T>::type;

Computes the return type of a call to kumi::rotate_left

Examples

Tuple

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto values = kumi::tuple {'A','B','C','D','E','F'};
std::cout << values << "\n";
std::cout << kumi::rotate_left<1>(values) << "\n";
std::cout << kumi::rotate_left<3>(values) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33

Record

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto values = kumi::record{"a"_id=1,"b"_id=2,"c"_id=3,"d"_id=4,"e"_id=5,"f"_id=6};
std::cout << values << "\n";
std::cout << kumi::rotate_left<1>(values) << "\n";
std::cout << kumi::rotate_left<3>(values) << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36