carb::wrapInterfaceFunction

Defined in carb/BindingsUtils.h

template<typename InterfaceType, typename ReturnType, typename ...Args>
auto carb::wrapInterfaceFunction(const InterfaceType *c, ReturnType (*InterfaceType::* p)(Args...)) -> std::function<ReturnType(Args...)>

Wraps an interface function into a std::function<>.

This version captures the interface so that it does not need to be passed to every invocation.

Template Parameters
  • InterfaceType – The Carbonite interface type (i.e. logging::ILogging); can be inferred.

  • ReturnType – The return type of p; can be inferred.

  • Args – Arguments of p; can be inferred.

Parameters
  • c – The Carbonite interface to capture as part of the wrapper function.

  • p – The interface function to wrap.

Returns

A std::function<ReturnType(Args...)> wrapper around p.