kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches

◆ rotate_left()

template<std::size_t R, concepts::product_type T>
constexpr auto kumi::rotate_left ( T &&  t)
constexpr

Rotates the element of a product type R positions to the left, wrapping around when getting to the beginning.

Template Parameters
RRotation factor
Parameters
tProduct type to rotate.
Returns
A product type equivalent to t with elements rotated R positions to the left.

Helper type

namespace kumi::result
{
template<std::size_t R, product_type T> struct rotate_left;
template<std::size_t R, product_type T>
using rotate_left_t = typename rotate_left<R, T>::type;
}
constexpr auto rotate_left(T &&t)
Rotates the element of a product type R positions to the left, wrapping around when getting to the be...
Definition rotate.hpp:59

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

Example

#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:32
#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";
}