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

◆ push_front

push_front_t kumi::push_front {}
inlineconstexprnodiscard

Callable object constructing a product type by adding a value v at the beginning of t.

Callable object constructing a product type by adding a value v at the end of t.

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/push_pop.hpp>

Call Signature

template<product_type T, typename V>
constexpr auto push_front(T && t, V && v);
constexpr push_front_t push_front
Callable object constructing a product type by adding a value v at the beginning of t.
Definition push_pop.hpp:115

Parameters

  • t: Base product type
  • v: Value to insert in front of t

Return value

  • A product type composed of v followed by all elements of t in order.

Helper type

template<kumi::concepts::product_type T, typename V> struct push_front
{
using type = decltype(kumi::push_front(std::declval<T>(), std::declval<V>()));
};
template<kumi::concepts::product_type T, typename V>
using push_front_t = typename kumi::result::push_front<T, V>::type;

Computes the return type of a call to kumi:push_front

Examples

Tuple

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
std::cout << kumi::push_front( kumi::tuple{}, 63.21) << "\n";
kumi::tuple t{1,2.,3.4f};
std::cout << t << "\n";
std::cout << kumi::push_front(t, 'Z') << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33

Record

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
std::cout << kumi::push_front( kumi::record{}, "a"_id = 63.21) << "\n";
kumi::record t{"a"_id = 1,"b"_id = 2.,"c"_id = 3.4f};
std::cout << t << "\n";
std::cout << kumi::push_front(t, "d"_id = 'Z') << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36

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/push_pop.hpp>

Call Signature

template<product_type T, typename V>
constexpr auto push_back(T && t, V && v);

Parameters

  • t: Base product type
  • v: Value to insert at the end of t

Return value

A product type composed of all elements of `t` in order followed by `v`.

Helper type

template<kumi::concepts::product_type T, typename V> struct push_back
{
using type = decltype(kumi::push_back(std::declval<T>(), std::declval<V>()));
};
template<kumi::concepts::product_type T, typename V>
using push_back_t = typename kumi::result::push_back<T, V>::type;

Computes the return type of a call to kumi:push_back

Examples

Tuple

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
std::cout << kumi::push_back( kumi::tuple{}, 63.21) << "\n";
kumi::tuple t{1,2.,3.4f};
std::cout << t << "\n";
std::cout << kumi::push_back(t, 'Z') << "\n";
}

Record

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
std::cout << kumi::push_back( kumi::record{}, "a"_id = 63.21) << "\n";
kumi::record t{"a"_id = 1,"b"_id = 2.,"c"_id = 3.4f};
std::cout << t << "\n";
std::cout << kumi::push_back(t, "d"_id = 'Z') << "\n";
}