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

◆ push_back()

template<concepts::product_type T, typename V>
auto kumi::push_back ( T && t,
V && v )
inlinenodiscardconstexpr

Constructs a product type by adding a value v at the end of t.

Parameters
tBase product type
vValue to insert in front of t
Returns
A product type composed of all elements of t in order followed by v.

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

Helper type

namespace kumi::result
{
template<product_type T, typename V> struct push_back;
template<product_type T, typename V>
using push_back_t = typename push_back<T,V>::type;
}
constexpr auto push_back(T &&t, V &&v)
Constructs a product type by adding a value v at the end of t.
Definition push_pop.hpp:120

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";
}
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_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";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36