KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches
kumi::push_back

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

Variables

constexpr push_back_t kumi::push_back {}

Detailed Description

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

Variable Documentation

◆ push_back

push_back_t kumi::push_back {}
inlineconstexprnodiscard

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

Call Signature

namespace kumi
{
template<concepts::product_type T, typename V>
constexpr auto push_back(T && t, V && v);
}
constexpr push_back_t push_back
Definition push_pop.hpp:246
Main KUMI namespace.
Definition algorithm.hpp:11

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>
using push_back_t = decltype(kumi::push_back(kumi::declval<T>(), kumi::declval<V>()));
template<kumi::concepts::product_type T, typename V> struct push_back
{
using type = kumi::result::push_back_t<T, V>;
};

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:35
  • 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 fields with distinct labels.
    Definition record.hpp:36