Reorder elements of a kumi::product_type.
This function does not participate in overload resolution if any Idx is outside [0, size_v<T>[.
- Note
- Nothing prevent the number of reordered index to be lesser or greater than t size or the fact they can appear multiple times.
-
reorder(tuple) works and is equivalent to reorder<>(tuple)
- Template Parameters
-
| Idx | Reordered index of elements |
- Parameters
-
- Returns
- A tuple equivalent to kumi::make_tuple(t[index<Idx>]...);
Helper type
namespace kumi::result
{
using reorder_t =
typename reorder<Tuple,Idx...>::type;
}
Concept specifying a type follows the Product Type semantic.
Definition concepts.hpp:33
constexpr auto reorder(T &&t)
Reorder elements of a kumi::product_type.
Definition reorder.hpp:74
Computes the return type of a call to kumi::reorder
Examples:
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
std::cout << values << "\n";
std::cout << kumi::reorder<2,1,0>(values) << "\n";
std::cout << kumi::reorder<2,1,0,1,2>(values) << "\n";
std::cout << kumi::reorder<1,1>(values) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:37
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
using namespace kumi::literals;
auto values =
kumi::record {
"a"_f = 1,
"b"_f =
'a',
"c"_f = 0.1 };
std::cout << values << "\n";
std::cout << kumi::reorder<2,1,0>(values) << "\n";
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition traits.hpp:366