#include <ugmisc/member.hpp>
Public Member Functions | |
| template<class... T> | |
| constexpr auto | operator() (T &&...objs) const |
Static Public Member Functions | |
| template<class F> | |
| static constexpr default_function< F > | fallback (F &&f) |
| template<class... T> | |
| static constexpr wrapped_objects< void, T... > | with (T &&...objs) |
Calls a named member function of objects, trying them in sequence until one will accept the arguments, optionally providing a fallback default value.
For example:
val is the value of the first of these expressions which is valid:
The inclusion of the std::invoke variant of the call allows a tried object to have a poiner-to-member member called foo, and the first argument supplied is then the object whose member will be the callable that takes the rest of the arguments.
It may be more convenient to use member_caller as an object.
...or even (if it is safe to keep the references to x and y alive):
Definition at line 750 of file member.hpp.
|
inlinestaticconstexpr |
| f | A function or other callable which provides a default value if none of the objects can be called. |
Definition at line 933 of file member.hpp.
|
inlineconstexpr |
Definition at line 944 of file member.hpp.
|
inlinestaticconstexpr |
| objs | Objects to try calling. |
Definition at line 939 of file member.hpp.