Reindex 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.
- Template Parameters
-
| Indexes | A kumi::indexes representing the reindexed slot of the elements |
- Parameters
-
| t | kumi::product_type to reindex |
- Returns
- A potentially nested tuple following the Indexes order
Helper type
namespace kumi::result
{
template<product_type T, index_map auto Idxs>
struct reindex;
template<product_type T, index_map auto Idxs>
}
constexpr auto reindex(T &&t)
Reindex elements of a kumi::product_type.
Definition reorder.hpp:143
Computes the return type of a call to kumi::reindex
Example
#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
std::cout << values << "\n";
std::cout << kumi::reindex<basic>(values) << "\n";
std::cout << kumi::reindex<stack>(values) << "\n";
std::cout << kumi::reindex<pairs>(values) << "\n";
}
consteval auto indexes(Ts... ts) noexcept
Creates a kumi::indexes object, deducing the target type from the types of arguments.
Definition indexes.hpp:111
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:29
#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";
std::cout << kumi::reindex<basic>(values) << "\n";
}
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition record.hpp:29