|
kmMqtt 0.0.1
MQTT Client Library
|
A move-only type-erased callable wrapper with small buffer optimization. More...
#include <UniqueFunction.h>
Public Member Functions | |
| template<typename TFunc> | |
| UniqueFunction (TFunc &&func) | |
| Constructs UniqueFunction from any callable object. | |
A move-only type-erased callable wrapper with small buffer optimization.
UniqueFunction allows storing and invoking any callable object (such as lambdas, functors, or function pointers) with a void() signature. It is move-only and cannot be copied. The implementation allows the use of small buffer optimization (SBO) when ENABLE_UNQIUEFUNCTION_SBO is defined.
Memory management:
Exception guarantee: The call operator provides strong noexcept guarantee.
Example usage:
|
inline |
Constructs UniqueFunction from any callable object.
| TFunc | The type of the callable object. |
| func | The callable object to store. |