Callable object reordering elements of a Record Type.
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.
-
reorder(tuple) works and is equivalent to reorder<>(tuple)
#include <kumi/algorithm/reorder.hpp>
constexpr reorder_fields_t< Name... > reorder_fields
Callable object reordering elements of a Record Type.
Definition reorder.hpp:185
identifier definition class
Definition identifier.hpp:86
- Ids Identifiers of the elements to reorder
- t: Product Type to reorder
- A product type with the type of t with elements equal to get<Ids>(t) for each given identifer.
template<kumi::concepts::product_type Tuple, kumi::concepts::identifier
auto... Name>
struct reorder_fields
{
};
template<kumi::concepts::product_type Tuple, kumi::concepts::identifier auto... Name>
using reorder_fields_t = typename kumi::result::reorder_fields<Tuple, Name...>::type;
Computes the return type of a call to kumi::reorder_fields
#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