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
-
- 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>
using reindex_t= typename reindex<T,Idxs>::type;
}
constexpr auto reindex(T &&t)
Reindex elements of a kumi::product_type.
Definition reorder.hpp:146
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:121
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:37