Celeritas
0.5.0-86+4a8eea4
|
Host-only utilities for use with std::variant. More...
#include <type_traits>
#include <utility>
#include "corecel/Assert.hh"
#include "detail/VariantUtilsImpl.hh"
Classes | |
struct | celeritas::Overload< Ts > |
Helper class for dispatching type-specific lambdas. More... | |
class | celeritas::ContainerVisitor< T, U > |
Visit a container's element by calling "visit" on the corresponding index. More... | |
Typedefs | |
template<class E , template< E > class ETraits> | |
using | celeritas::EnumVariant = typename detail::EnumVariantImpl< E, ETraits >::type |
Define a variant that contains all the classes mapped by an enum+traits. More... | |
Functions | |
template<class... Ts> | |
celeritas::Overload (Ts &&...) -> Overload< Ts... > | |
template<class T , class F > | |
detail::ReturnAsImpl< T, F > | celeritas::return_as (F &&func) |
Create a wrapper functor for unifying the return type. More... | |
template<class T > | |
celeritas::ContainerVisitor (T &&) -> ContainerVisitor< T > | |
Host-only utilities for use with std::variant.
using celeritas::EnumVariant = typedef typename detail::EnumVariantImpl<E, ETraits>::type |
Define a variant that contains all the classes mapped by an enum+traits.
For example:
is equivalent to:
detail::ReturnAsImpl<T, F> celeritas::return_as | ( | F && | func | ) |
Create a wrapper functor for unifying the return type.
This provides a unified return type T
(usually a variant) that can be implicitly constructed from all return types of a functor F
that operates on a generic type U
. The class is necessary because std::visit
requires all return types to be the same.
Example: