template <size_t inline_target_size, bool require_inline, typename Allocator, typename Result, typename... Args>

class callback_impl

Defined at line 352 of file ../../sdk/lib/fit/include/lib/fit/function.h

Public Methods

void callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> ()

Initializes an empty (null) callback. Attempting to call an empty

callback will abort the program.

Defined at line 379 of file ../../sdk/lib/fit/include/lib/fit/function.h

void callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> (decltype(nullptr) )

Creates a callback with an empty target (same outcome as the default

constructor).

Defined at line 383 of file ../../sdk/lib/fit/include/lib/fit/function.h

void callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> (Result (*)(Args...) callback_target)

Creates a callback bound to the specified function pointer.

If target == nullptr, assigns an empty target.

Defined at line 387 of file ../../sdk/lib/fit/include/lib/fit/function.h

template <typename Callable, requires_conditions<
                                    std::is_convertible<decltype(std::declval<Callable&>()(std::declval<Args>()...)),
                                                        result_type>,
                                    not_self_type<Callable>> = true>
void callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> (Callable && callback_target)

Creates a callback bound to the specified callable object.

If target == nullptr, assigns an empty target.

For functors, we need to capture the raw type but also restrict on the

existence of an appropriate operator () to resolve overloads and implicit

casts properly.

Defined at line 400 of file ../../sdk/lib/fit/include/lib/fit/function.h

void callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> (callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> && other)

Creates a callback with a target moved from another callback,

leaving the other callback with an empty target.

Defined at line 404 of file ../../sdk/lib/fit/include/lib/fit/function.h

void ~callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> ()

Destroys the callback, releasing its target.

Defined at line 407 of file ../../sdk/lib/fit/include/lib/fit/function.h

callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> & operator= (decltype(nullptr) )

Assigns the callback to an empty target. Attempting to invoke the

callback will abort the program.

Defined at line 411 of file ../../sdk/lib/fit/include/lib/fit/function.h

template <typename Callable>
assignment_requires_conditions<std::is_convertible<decltype(std::declval<Callable &>()(std::declval<Args>()...)), result_type>, not_self_type<Callable>> operator= (Callable && callback_target)

NOLINTNEXTLINE(misc-unconventional-assign-operator)

Defined at line 424 of file ../../sdk/lib/fit/include/lib/fit/function.h

callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> & operator= (callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> && other)

Move assignment

Defined at line 433 of file ../../sdk/lib/fit/include/lib/fit/function.h

void swap (callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> & other)

Swaps the callbacks' targets.

Defined at line 441 of file ../../sdk/lib/fit/include/lib/fit/function.h

bool operator bool ()

Returns true if the callback has a non-empty target.

Defined at line 444 of file ../../sdk/lib/fit/include/lib/fit/function.h

Result operator() (Args... args)

Invokes the callback's target.

Aborts if the callback's target is empty.

|fit::callback| must be non-const to invoke. Before the target function

is actually called, the fit::callback will be set to the default empty

state (== nullptr, and operator bool() will subsequently return |false|).

The target function will then be released after the function is called.

If the callback was shared, any remaining copies will also be cleared.

Defined at line 461 of file ../../sdk/lib/fit/include/lib/fit/function.h

callback_impl<inline_target_size, require_inline, Result (Args...), Allocator> share ()

Returns a new callback object that invokes the same target.

The target itself is not copied; it is moved to the heap and its

lifetime is extended until all references have been released.

For |fit::callback| (unlike fit::function), the first invocation of the

callback will release all references to the target. All callbacks

derived from the same original callback (via share()) will be cleared,

as if set to |nullptr|, and "operator bool()" will return false.

Note: This method is not supported on |fit::inline_function

<

>|

because it may incur a heap allocation which is contrary to

the stated purpose of |fit::inline_function

<

>|.

Defined at line 477 of file ../../sdk/lib/fit/include/lib/fit/function.h