eswitch-v5
Advanced counterpart for switch statement in C++
eswitch_v5::eswitch_impl< Args > Class Template Reference

Description

template<typename ... Args>
class eswitch_v5::eswitch_impl< Args >

Accept arbitrary number of Case's and test each of them sequentially. If match was found then executes Case body, also based on Case falling option decides whether to execute next body or finish work.

Definition at line 704 of file eswitch_v5.hpp.

Instances and minimal complete definitions

struct  Padding
 

Public Types

template<typename T >
using args_t = details::amount_args< typename T::F >
 
template<typename T >
using underlying = details::invoke_result< typename T::F >
 
template<typename T >
using underlying_t = details::invoke_result_t< typename T::F >
 

Public Member Functions

template<typename ... Ts>
constexpr eswitch_impl (Ts &&... ts)
 
template<typename ... Cnds>
constexpr auto operator() (Cnds &&... cnds)
 

Member Function Documentation

◆ operator()()

template<typename ... Args>
template<typename ... Cnds>
constexpr auto eswitch_v5::eswitch_impl< Args >::operator() ( Cnds &&...  cnds)
constexpr

Definition at line 726 of file eswitch_v5.hpp.

727  {
728  if constexpr( ( !has_value< args_t< Cnds > > || ... ) )
729  {
730  static_assert( !( !has_value< args_t< Cnds > > || ... ),
731  "Predicate with 'auto' argument aren't ALLOWED!" );
732  }
733  else if constexpr( ( has_type< underlying< Cnds > > && ... ) )
734  {
735  static_assert( has_type< std::common_type< underlying_t< Cnds >... > >,
736  "Inconsistent 'Return type'!" );
737  }
738  }

Member Typedef Documentation

◆ args_t

template<typename ... Args>
template<typename T >
using eswitch_v5::eswitch_impl< Args >::args_t = details::amount_args< typename T::F >

Definition at line 723 of file eswitch_v5.hpp.

◆ underlying

template<typename ... Args>
template<typename T >
using eswitch_v5::eswitch_impl< Args >::underlying = details::invoke_result< typename T::F >

Definition at line 717 of file eswitch_v5.hpp.

◆ underlying_t

template<typename ... Args>
template<typename T >
using eswitch_v5::eswitch_impl< Args >::underlying_t = details::invoke_result_t< typename T::F >

Definition at line 720 of file eswitch_v5.hpp.

Constructor & Destructor Documentation

◆ eswitch_impl()

template<typename ... Args>
template<typename ... Ts>
constexpr eswitch_v5::eswitch_impl< Args >::eswitch_impl ( Ts &&...  ts)
constexpr

Definition at line 712 of file eswitch_v5.hpp.

712  : tup_( std::forward< Ts >( ts )... )
713  {
714  }
eswitch_v5::has_type
concept has_type
Definition: eswitch_v5.hpp:370
std::common_type
eswitch_v5::has_value
concept has_value
Definition: eswitch_v5.hpp:373