Reorder elements of a kumi::record.
This function will issue a compile time error if the identifiers are not in t
On record types, this function operates on elements as if they were ordered. The considered order is the order of declaration.
- Note
- Nothing prevent the number of reordered names to be lesser or greater than t size or the fact they can appear multiple times if it is applied on a named tuple.
- Template Parameters
-
| Name | Reordered names of elements |
- Parameters
-
- Returns
- A product type with the type of t with elements equal to get<Name>(t).
Helper type
namespace kumi::result
{
template<product_type Tuple,std::size_t... Idx>
struct reorder_fields;
template<product_type Tuple,std::size_t... Idx>
}
constexpr auto reorder_fields(Tuple &&t)
Reorder elements of a kumi::record.
Definition reorder.hpp:92
Computes the return type of a call to kumi::reorder_fields
Example:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto values =
kumi::record {
"a"_id = 1,
"b"_id =
'a',
"c"_id = 0.1 };
std::cout << values << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36