Death::Containers::FunctionData class

Function data storage

Type-erased base for Function. Suitable for storing type-erased function pointers in containers.

Derived classes

template<class R, class ... Args>
class Function<R(Args...)>
Function wrapper.

Constructors, destructors, conversion operators

FunctionData(std::nullptr_t = nullptr) noexcept
Default constructor.
FunctionData(const FunctionData&) deleted
Copying is not allowed.
FunctionData(FunctionData&&) noexcept
Move constructor.
~FunctionData()
operator bool() const explicit
Whether the function pointer is non-null.

Public functions

auto operator=(const FunctionData&) -> FunctionData& deleted
Copying is not allowed.
auto operator=(FunctionData&&) -> FunctionData& noexcept
Move assignment.
auto isAllocated() const -> bool
Whether the instance contains heap-allocated state.

Function documentation

Death::Containers::FunctionData::FunctionData(std::nullptr_t = nullptr) noexcept

Default constructor.

Creates a nullptr function.

Death::Containers::FunctionData::operator bool() const explicit

Whether the function pointer is non-null.

Returns false if the instance was default-constructed, constructed from a nullptr free or member function pointer or moved out, true otherwise.

bool Death::Containers::FunctionData::isAllocated() const

Whether the instance contains heap-allocated state.

Returns true if the instance was created from a capturing lambda or a functor with a large or non-trivially copyable state, false otherwise. In other words, always returns false for default-constructed instances, free and member function pointers and instances constructed with the NoAllocateInitT constructor.