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

class function_base

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

Function implementation details that require the function signature.

See |fit::function| and |fit::callback| documentation for more information.

Public Methods

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

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

Protected Methods

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

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

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

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

void function_base<inline_target_size, require_inline, Result (Args...), Allocator> (Result (*)(Args...) function_target)

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

template <typename Callable, typename = std::enable_if_t<std::is_convertible<
                                        decltype(std::declval<Callable&>()(std::declval<Args>()...)), result_type>::value>>
void function_base<inline_target_size, require_inline, Result (Args...), Allocator> (Callable && target)

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

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

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

template <typename Callable>
Callable * target (bool check)

Returns a pointer to the function's target.

If |check| is true (the default), the function _may_ abort if the

caller tries to assign the target to a varible of the wrong type. (This

check is currently skipped for share()d objects.)

Note the shared pointer vtable must set |check| to false to assign the

target to |void*|.

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

template <typename Callable>
const Callable * target (bool check)

Returns a pointer to the function's target (const version).

If |check| is true (the default), the function _may_ abort if the

caller tries to assign the target to a varible of the wrong type. (This

check is currently skipped for share()d objects.)

Note the shared pointer vtable must set |check| to false to assign the

target to |void*|.

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

template <typename SharedFunction>
void share_with (SharedFunction & copy)

Used by the derived "impl" classes to implement share().

The caller creates a new object of the same type as itself, and passes in

the empty object. This function first checks if |this| is already shared,

and if not, creates a new version of itself containing a |std::shared_ptr|

to its original self, and updates |ops_| to the vtable for the shared

version.

Then it copies its |shared_ptr| to the |bits_| of the given |copy|, and

assigns the same shared pointer vtable to the copy's |ops_|.

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

is extended until all references have been released.

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 497 of file ../../sdk/lib/fit/include/lib/fit/internal/function.h

Result invoke (Args... args)

Used by derived "impl" classes to implement operator()().

Invokes the function's target.

Note that fit::callback will release the target immediately after

invoke() (also affecting any share()d copies).

Aborts if the function's target is empty.

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

template <typename Callable, typename = std::enable_if_t<std::is_convertible<
                                        decltype(std::declval<Callable&>()(std::declval<Args>()...)), result_type>::value>>
void assign_callable (Callable && target)

Used by derived "impl" classes to implement operator=().

Assigns the function's target.

If target == nullptr, assigns an empty target.

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