cortexlib  v0.2.0
Classes | Functions
cxl::utils Namespace Reference

Classes

struct  match
 match structure More...
 
struct  match_any
 Wildcard Empty Placeholder. More...
 

Functions

template<typename... Fs>
 match (Fs &&...) -> match< std::remove_reference_t< Fs >... >
 Template Deduction Guide. More...
 
template<typename... Ts, typename... Fs>
constexpr auto operator>> (const std::variant< Ts... > &var, const match< Fs... > &m) -> void
 Match Expression Notation. More...
 
template<typename... Ts, typename... Fs>
constexpr auto operator<< (const std::variant< Ts... > &var, const match< Fs... > &m) -> decltype(auto)
 Match Expression Assignment Overload. More...
 

Function Documentation

◆ match()

template<typename... Fs>
cxl::utils::match ( Fs &&  ...) -> match< std::remove_reference_t< Fs >... >

Template Deduction Guide.

◆ operator<<()

template<typename... Ts, typename... Fs>
constexpr auto cxl::utils::operator<< ( const std::variant< Ts... > &  var,
const match< Fs... > &  m 
) -> decltype(auto)
constexpr

Match Expression Assignment Overload.

Overloads the >>= operator to reverse the argument order of a match expression for a cleaner syntax with existing match types and to denote an explicit syntax for match expressions that return a value.

Template Parameters
...Ts
...Fs
Parameters
vartype: const std::variant<Ts...>&
mtype: const match<Fs...>&
Returns
decltype(auto)

◆ operator>>()

template<typename... Ts, typename... Fs>
constexpr auto cxl::utils::operator>> ( const std::variant< Ts... > &  var,
const match< Fs... > &  m 
) -> void
constexpr

Match Expression Notation.

Overloads >> to reverse the argument order of a match expression for a cleaner syntax with existing match types.

Template Parameters
...Ts
...Fs
Parameters
vartype: const std::variant<Ts...>&
mtype const match<Fs...>&
Returns
auto