KUMI v5.0.0
Gorgeous Garnet
Loading...
Searching...
No Matches

Callable object used to retrieve the back of a product type. More...

Variables

constexpr back_t kumi::back {}

Detailed Description

Callable object used to retrieve the back of a product type.

Variable Documentation

◆ back

back_t kumi::back {}
inlineconstexprnodiscard
Note
This function does not take part in overload resolution if t is an empty product type.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<concepts::product_type T>
[[nodiscard]] constexpr decltype(auto) back(T && t);
}
constexpr back_t back
Definition back_front.hpp:150
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

  • t: Product Type to access

Return value

  • A reference to the last element of the product type t.

Helper type

template<kumi::concepts::product_type T> using back_t = kumi::stored_member_t<kumi::size_v<T> - 1, T>;
template<kumi::concepts::product_type T> struct back
{
using type = kumi::result::back_t<T>;
};

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

Examples

  • Tuple
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    kumi::tuple x{2.3,18, 5.f};
    std::cout << kumi::front(x) << "\n";
    std::cout << kumi::back(x) << "\n";
    kumi::front(x) = 98.5;
    kumi::back(x) = 66.f;
    std::cout << x << "\n";
    }
    constexpr front_t front
    Definition back_front.hpp:90
    Fixed-size collection of heterogeneous values.
    Definition tuple.hpp:35
  • Record
    #include <kumi/kumi.hpp>
    #include <iostream>
    int main()
    {
    using namespace kumi::literals;
    kumi::record x{"a"_id = 2.3,"b"_id = 18, "c"_id = 5.f};
    std::cout << kumi::front(x) << "\n";
    std::cout << kumi::back(x) << "\n";
    kumi::front(x) = 98.5;
    kumi::back(x) = 66.f;
    std::cout << x << "\n";
    }
    Fixed-size collection of heterogeneous fields with distinct labels.
    Definition record.hpp:36