kumi v3.1.0
Exquisite Epidote
 
Loading...
Searching...
No Matches

◆ cast()

template<typename... Ts>
template<typename... Us>
requires ( _::piecewise_convertible<tuple, tuple<Us...>> && (sizeof...(Us) == sizeof...(Ts)) && (!std::same_as<Ts, Us> && ...) )
constexpr auto kumi::tuple< Ts >::cast ( ) const
inlineconstexpr

Converts a tuple<Ts...> to a tuple<Us...>.

Template Parameters
UsTypes composing the destination tuple

Example:

#include <kumi/tuple.hpp>
#include <iostream>
int main()
{
kumi::tuple a = { 65, 2.3, 4.5f};
auto b = a.cast<char,int,double>();
std::cout << a << "\n";
std::cout << b << "\n";
}
constexpr auto cast() const
Converts a tuple<Ts...> to a tuple<Us...>.
Definition: tuple.hpp:124
Fixed-size collection of heterogeneous values.
Definition: tuple.hpp:35