Loading...
Searching...
No Matches
Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
args< ARGS > Struct Template Reference

Forward declaration. More...

#include <args.h>

Public Member Functions

Constructors
template<typename... Ts>
requires is_compatible<Ts...>
constexpr args (args< Ts... > &&arg)
 Copy constructor for compatible arg_lists.
 
template<typename... Ts>
requires is_compatible<Ts...>
constexpr args (Ts &&... arg)
 Constructor from a compatible list of arguments.
 

Static Public Attributes

compatibility checks of series of arguments with ARGS
template<typename... Ts>
static constexpr bool is_compatible = _is_compatible_fwd<Ts...>()
 
template<typename... Ts>
static constexpr bool is_cpp_compatible = _is_cpp_compatible_fwd<Ts...>()
 

Private Member Functions

template<size_t... IDX>
constexpr auto _value (std::index_sequence< IDX... >) const
 Return the value of all arguments.
 

Static Private Member Functions

template<string_literal Name, typename T = void, typename D = void>
static constexpr size_t _lookup (arg< T, Name, D >=arg< T, Name, D >{})
 Lookup a name.
 
template<typename TUP , size_t... IDX>
static constexpr decltype(auto) _retrieve_args (TUP &&src, std::index_sequence< IDX... >)
 Populate the 'args' from a tuple of arguments.
 
template<size_t IDX, typename TUP >
static constexpr decltype(auto) _retrieve_arg (TUP &&src)
 Find in a tuple of arguments the one that best matches the 'IDX'-th ARG in ARGS.
 
template<typename TUP >
static constexpr bool _is_compatible (void)
 Checks if a tuple of arguments is compatible with ARGS.
 
template<typename TUP >
static constexpr bool _is_cpp_compatible (void)
 Check if a tuple of arguments is compatible in a classic C++ sense with ARGS.
 
template<size_t IDX, typename TUP >
static constexpr size_t _find_arg_index (void)
 Find the element in a tuple of argument values that best matches the IDX-th 'ARGS'.
 
Helper forward functions
template<typename... Ts>
static constexpr bool _is_compatible_fwd (void)
 
template<typename... Ts>
static constexpr bool _is_cpp_compatible_fwd (void)
 

Private Attributes

std::tuple< ARGS... > _values
 

Inspectors

template<size_t IDX>
using type = std::tuple_element_t< IDX, std::tuple< ARGS... > >
 type of the IDX argument
 
using values_t = bbm::named< std::tuple< typename ARGS::type... >, ARGS::name... >
 type of values()
 
static constexpr size_t size = sizeof...(ARGS)
 
template<size_t IDX>
static constexpr string_literal name = std::tuple_element_t<IDX, std::tuple<ARGS...>>::name
 name of the IDX argument
 
constexpr auto values (void) const
 Returns a tuple of all arguments' values.
 
template<size_t IDX>
constexpr decltype(auto) get (void)
 Get the IDX-th argument (bbm::arg type)
 
template<size_t IDX>
constexpr decltype(auto) get (void) const
 
template<size_t IDX>
constexpr decltype(auto) value (void)
 Get the value of the IDX-th argument.
 
template<size_t IDX>
constexpr decltype(auto) value (void) const
 
template<string_literal Name, typename T = void, typename D = void>
constexpr decltype(auto) get (arg< T, Name, D >=arg< T, Name, D >{})
 Get the argument matching a given name (bbm::arg type)
 
template<string_literal Name, typename T = void, typename D = void>
constexpr decltype(auto) get (arg< T, Name, D >=arg< T, Name, D >{}) const
 
template<string_literal Name, typename T = void, typename D = void>
constexpr decltype(auto) value (arg< T, Name, D >=arg< T, Name, D >{})
 Get the value of the argument with a given name.
 
template<string_literal Name, typename T = void, typename D = void>
constexpr decltype(auto) value (arg< T, Name, D >=arg< T, Name, D >{}) const
 

Detailed Description

template<typename... ARGS>
requires (is_arg_v<ARGS> && ...)
struct bbm::args< ARGS >

Forward declaration.

Main declaration of 'args'.

Member Typedef Documentation

◆ type

using type = std::tuple_element_t<IDX, std::tuple<ARGS...> >

type of the IDX argument

◆ values_t

using values_t = bbm::named< std::tuple<typename ARGS::type...>, ARGS::name... >

type of values()

Constructor & Destructor Documentation

◆ args() [1/2]

constexpr args ( args< Ts... > &&  arg)
inlineconstexpr

Copy constructor for compatible arg_lists.

◆ args() [2/2]

constexpr args ( Ts &&...  arg)
inlineconstexpr

Constructor from a compatible list of arguments.

Member Function Documentation

◆ _find_arg_index()

static constexpr size_t _find_arg_index ( void  )
inlinestaticconstexprprivate

Find the element in a tuple of argument values that best matches the IDX-th 'ARGS'.

Template Parameters
IDX= index in 'ARGS' to match
TUP= tuple of argument values
Returns
the index in TUP of the best matching element; returns sizeof(TUP) is no match is found.

Matching procedure:

  • Check for matching name and compatible type
  • Check for matching "IDX" name in TUP with compatible type
  • If TUP[IDX] is type compatible
  • If ARGS[IDX] type is unique and there exists a unique matching type in TUP
  • Else return sizeof<TUP> (fail)

◆ _is_compatible()

static constexpr bool _is_compatible ( void  )
inlinestaticconstexprprivate

Checks if a tuple of arguments is compatible with ARGS.

Template Parameters
TUP= tuple of argument types
Returns
true if the argument types in TUP form a valid initialization for ARGS

◆ _is_compatible_fwd()

static constexpr bool _is_compatible_fwd ( void  )
inlinestaticconstexprprivate

◆ _is_cpp_compatible()

static constexpr bool _is_cpp_compatible ( void  )
inlinestaticconstexprprivate

Check if a tuple of arguments is compatible in a classic C++ sense with ARGS.

Template Parameters
TUP= tuple of argument types
Parameters
index_sequence[0, sizeof...(ARGS)]
Returns
true if the argument types in TUP form a valid initialization for ARGS

◆ _is_cpp_compatible_fwd()

static constexpr bool _is_cpp_compatible_fwd ( void  )
inlinestaticconstexprprivate

◆ _lookup()

static constexpr size_t _lookup ( arg< T, Name, D >  = arg<T, Name, D>{})
inlinestaticconstexprprivate

Lookup a name.

Parameters
name= bbm::arg with name to look up
Returns
the index of the matching arg (or size if failed)

◆ _retrieve_arg()

static constexpr decltype(auto) _retrieve_arg ( TUP &&  src)
inlinestaticconstexprprivate

Find in a tuple of arguments the one that best matches the 'IDX'-th ARG in ARGS.

Template Parameters
IDX= index in ARGS to find the best match
Parameters
src= tuple of argument values
Returns
the matching ARG from TUP

◆ _retrieve_args()

static constexpr decltype(auto) _retrieve_args ( TUP &&  src,
std::index_sequence< IDX... >   
)
inlinestaticconstexprprivate

Populate the 'args' from a tuple of arguments.

Parameters
src= tuple of argument values
index_sequence[0, sizeof...(ARGS)]
Returns
tuple of values

◆ _value()

constexpr auto _value ( std::index_sequence< IDX... >  ) const
inlineconstexprprivate

Return the value of all arguments.

Parameters
index_sequence= [0, sizeof(ARGS)]
Returns
named tuple of argument values

◆ get() [1/4]

constexpr decltype(auto) get ( arg< T, Name, D >  = arg<T,Name,D>{})
inlineconstexpr

Get the argument matching a given name (bbm::arg type)

◆ get() [2/4]

constexpr decltype(auto) get ( arg< T, Name, D >  = arg<T,Name,D>{}) const
inlineconstexpr

◆ get() [3/4]

constexpr decltype(auto) get ( void  )
inlineconstexpr

Get the IDX-th argument (bbm::arg type)

◆ get() [4/4]

constexpr decltype(auto) get ( void  ) const
inlineconstexpr

◆ value() [1/4]

constexpr decltype(auto) value ( arg< T, Name, D >  = arg<T,Name,D>{})
inlineconstexpr

Get the value of the argument with a given name.

◆ value() [2/4]

constexpr decltype(auto) value ( arg< T, Name, D >  = arg<T,Name,D>{}) const
inlineconstexpr

◆ value() [3/4]

constexpr decltype(auto) value ( void  )
inlineconstexpr

Get the value of the IDX-th argument.

◆ value() [4/4]

constexpr decltype(auto) value ( void  ) const
inlineconstexpr

◆ values()

constexpr auto values ( void  ) const
inlineconstexpr

Returns a tuple of all arguments' values.

Member Data Documentation

◆ _values

std::tuple<ARGS...> _values
private

◆ is_compatible

constexpr bool is_compatible = _is_compatible_fwd<Ts...>()
staticconstexpr

◆ is_cpp_compatible

constexpr bool is_cpp_compatible = _is_cpp_compatible_fwd<Ts...>()
staticconstexpr

◆ name

constexpr string_literal name = std::tuple_element_t<IDX, std::tuple<ARGS...>>::name
staticconstexpr

name of the IDX argument

◆ size

constexpr size_t size = sizeof...(ARGS)
staticconstexpr

The documentation for this struct was generated from the following file: