BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Classes | Public Types | Public Member Functions | List of all members
fc::detail::optionals_callable< R, Parameters > Struct Template Reference

#include <api.hpp>

Inheritance diagram for fc::detail::optionals_callable< R, Parameters >:

Classes

struct  pack_cutter
 
struct  pack_cutter_impl
 
struct  pack_cutter_impl< 0, void, Types... >
 
struct  pack_cutter_impl< RemoveCount, std::enable_if_t< RemoveCount !=0 >, T, Types... >
 
struct  short_pack
 

Public Types

template<unsigned RemoveCount, typename... Types>
using pack_cutter_t = typename pack_cutter< RemoveCount, Types... >::type
 

Public Member Functions

template<typename F , typename... OptionalTypes>
call_function (F &&f, short_pack< OptionalTypes... >)
 

Detailed Description

template<typename R, typename... Parameters>
struct fc::detail::optionals_callable< R, Parameters >

A wrapper of std::function allowing callers to omit the last several arguments if those arguments are fc::optional types. i.e. given a function taking (int, double, bool, fc::optional<string>, fc::optional<char>), whereas normally the last two arguments must be provided, this template allows them to be omitted. Note that this only applies to trailing optional arguments, i.e. given a callable taking (fc::optional<int>, int, fc::optional<int>), only the last argument can be omitted.

A discussion of how exactly this works is available here: https://github.com/bitshares/bitshares-fc/pull/126#issuecomment-490566060

Definition at line 35 of file api.hpp.

Member Typedef Documentation

◆ pack_cutter_t

template<typename R , typename... Parameters>
template<unsigned RemoveCount, typename... Types>
using fc::detail::optionals_callable< R, Parameters >::pack_cutter_t = typename pack_cutter<RemoveCount, Types...>::type

Definition at line 59 of file api.hpp.

Member Function Documentation

◆ call_function()

template<typename R , typename... Parameters>
template<typename F , typename... OptionalTypes>
R fc::detail::optionals_callable< R, Parameters >::call_function ( F &&  f,
short_pack< OptionalTypes... >   
)
inline

Definition at line 62 of file api.hpp.


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