Empirical
|
#include <flex_function.h>
Public Types | |
using | size_t = std::size_t |
using | return_t = R |
using | fun_t = std::function< R(ARGS...)> |
using | this_t = flex_function< R(ARGS...)> |
using | tuple_t = std::tuple< ARGS... > |
Public Member Functions | |
template<typename T > | |
flex_function (T &&fun_info) | |
flex_function (const this_t &)=default | |
flex_function (this_t &&)=default | |
flex_function () | |
this_t & | operator= (const this_t &)=default |
this_t & | operator= (this_t &&)=default |
this_t & | operator= (const fun_t &_f) |
this_t & | operator= (fun_t &&_f) |
template<typename T > | |
this_t & | operator= (T &&arg) |
template<int ID> | |
void | SetDefault (pack_id< ID, ARGS... > &in_default) |
Set the default value for a specific parameter. More... | |
void | SetDefaults (ARGS...args) |
Set the default values for all parameters. More... | |
return_t | operator() (ARGS...k) const |
Allow the function to be called with all args. More... | |
template<class... IN_ARGS> | |
return_t | operator() (IN_ARGS &&...k) const |
All the function to be called with a subset of arguments (and the rest set to defaults) More... | |
operator bool () const | |
Determine whether this function has been set. More... | |
Static Public Attributes | |
static constexpr int | num_args = sizeof...(ARGS) |
A functon class that is almost identical to std::function, but is provided with default values for all parameters so that it can be called with fewer arguments, as needed.
using emp::flex_function< R(ARGS...)>::fun_t = std::function<R(ARGS...)> |
using emp::flex_function< R(ARGS...)>::return_t = R |
using emp::flex_function< R(ARGS...)>::size_t = std::size_t |
using emp::flex_function< R(ARGS...)>::this_t = flex_function<R(ARGS...)> |
using emp::flex_function< R(ARGS...)>::tuple_t = std::tuple<ARGS...> |
|
inline |
|
default |
|
default |
|
inline |
|
inline |
Determine whether this function has been set.
|
inline |
Allow the function to be called with all args.
|
inline |
All the function to be called with a subset of arguments (and the rest set to defaults)
|
default |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
Set the default value for a specific parameter.
|
inline |
Set the default values for all parameters.
|
static |