KUMI v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches
kumi::as< T > Class Template Reference

Lightweight type-wrapper. More...

#include <kumi/utils/as.hpp>

Detailed Description

template<typename T>
class kumi::as< T >

Lightweight type-wrapper.

kumi::as Wraps type into a constexpr, trivially constructible empty class to optimize passing type parameters via object instead of via template parameters. A specialisation is provided if T is void.

Template Parameters
TType to wrap

Example:

#include <kumi/kumi.hpp>
#include <iostream>
template<typename T>
void display (kumi::as<T>)
{
if constexpr ( std::same_as<T,void>)
std::cout << "Type is void\n";
else
std::cout << "Other type\n";
}
int main()
{
int a = 12;
display(kumi::as(a));
display(kumi::as<void>{});
}
Lightweight type-wrapper.
Definition as.hpp:29

Public Types

using type = T
 Wrapped type.