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

Creates a kumi::tuple of forwarding references to its arguments. More...

Variables

constexpr forward_as_tuple_t kumi::forward_as_tuple {}

Detailed Description

Creates a kumi::tuple of forwarding references to its arguments.

Variable Documentation

◆ forward_as_tuple

forward_as_tuple_t kumi::forward_as_tuple {}
inlineconstexprnodiscard

Constructs a tuple of references to the arguments in ts suitable for forwarding as an argument to a function. The tuple has rvalue reference data members when rvalues are used as arguments, and otherwise has lvalue reference data members.

Note
If the arguments are temporaries, forward_as_tuple does not extend their lifetime; they have to be used before the end of the full expression.

Header file

#include <kumi/kumi.hpp>

Call Signature

namespace kumi
{
template<typename... Ts>
constexpr auto forward_as_tuple(Ts&&... ts);
}
constexpr forward_as_tuple_t forward_as_tuple
Definition tuple.hpp:600
Main KUMI namespace.
Definition algorithm.hpp:11

Parameters

  • ts: Zero or more arguments to construct the tuple from.

Return value

Example

#include <kumi/kumi.hpp>
#include <iostream>
#include <vector>
#include <string>
template<typename Data>
std::vector<std::string> build(Data d)
{
return std::vector<std::string> ( kumi::get<0>(d)
, std::move(kumi::get<1>(d))
);
}
int main()
{
auto v = build( kumi::forward_as_tuple(4,std::string{"the text !"}));
for(auto const& s : v)
std::cout << s << "\n";
}
decltype(auto) constexpr get(array< T, N > &t) noexcept
Extracts the Ith element from a kumi::array.
Definition array.hpp:672