Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
|
Delegated target function object, providing a fast path target function invocation. More...
#include <functional.hpp>
Classes | |
struct | final_opt |
C++ conform Pointer to Member Function (PMF) More... | |
Public Types | |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef delegate_t< R, A... > | delegate_type |
typedef jau::nsize_t | size_type |
Utilize a natural size type jau::nsize_t. | |
Public Member Functions | |
~delegate_t () noexcept | |
constexpr size_t | cached_size () const noexcept |
template<typename T, std::enable_if_t< use_trivial_cache< T >(), bool > = true> | |
constexpr const T * | data () const noexcept |
template<typename T, std::enable_if_t< use_any_heap< T >(), bool > = true> | |
constexpr const T * | data () const noexcept |
template<typename T, std::enable_if_t< use_trivial_cache< T >(), bool > = true> | |
constexpr T * | data () noexcept |
template<typename T, std::enable_if_t< use_any_heap< T >(), bool > = true> | |
constexpr T * | data () noexcept |
delegate_t (const delegate_t &o) noexcept | |
delegate_t (delegate_t &&o) noexcept | |
constexpr size_t | heap_size () const noexcept |
constexpr bool | is_trivially_copyable () const noexcept |
Returns true if the underlying target function is TriviallyCopyable . | |
constexpr R | operator() (A... args) const |
Delegated fast path target function invocation, see above. | |
delegate_t & | operator= (const delegate_t &o) noexcept |
delegate_t & | operator= (delegate_t &&o) noexcept |
constexpr bool | operator== (const delegate_t< R, A... > &rhs) const noexcept |
Delegated fast path target function equality operator. | |
constexpr size_t | target_size () const noexcept |
Returns the size of underlying target function. | |
constexpr target_type | type () const noexcept |
Return the func::target_type of this invocation function wrapper. | |
Static Public Member Functions | |
static delegate_type | delegate () noexcept |
static delegate_type | delegate (C1 *base, R(C0::*method)(A...), std::enable_if_t< std::is_base_of_v< C0, C1 >, bool >=true) noexcept |
Construct a delegate_t<R, A...> instance from given this base-pointer and member-function. | |
static delegate_type | delegate (const I &data, R(*function)(I &, A...)) noexcept |
static delegate_type | delegate (I &&data, R(*function)(I &, A...)) noexcept |
static delegate_type | delegate (I *data_ptr, R(*function)(I *, A...)) noexcept |
static delegate_type | delegate (L function) noexcept |
static delegate_type | delegate (L function) noexcept |
static delegate_type | delegate (R(*function)(A...)) noexcept |
static delegate_type | delegate (uint64_t id, std::function< R(A...)> function) noexcept |
template<typename T, std::enable_if_t<!use_nontrivial_heap< T >(), bool > = true> | |
static non_trivial_t * | getNonTrivialCtor () noexcept |
template<typename T, std::enable_if_t< use_nontrivial_heap< T >(), bool > = true> | |
static non_trivial_t * | getNonTrivialCtor () noexcept |
static delegate_t | make (const target_func_t &tfunc) noexcept |
template<typename T, typename... P, std::enable_if_t< use_trivial_cache< T >(), bool > = true> | |
static delegate_t | make (const target_func_t &tfunc, P... params) noexcept |
template<typename T, typename... P, std::enable_if_t< use_trivial_heap< T >(), bool > = true> | |
static delegate_t | make (const target_func_t &tfunc, P... params) noexcept |
template<typename T, typename... P, std::enable_if_t< use_nontrivial_heap< T >(), bool > = true> | |
static delegate_t | make (const target_func_t &tfunc, P... params) noexcept |
template<typename T> | |
static constexpr bool | use_any_heap () |
template<typename T> | |
static constexpr bool | use_nontrivial_heap () |
template<typename T> | |
static constexpr bool | use_trivial_cache () |
template<typename T> | |
static constexpr bool | use_trivial_heap () |
Delegated target function object, providing a fast path target function invocation.
func::std_target_t implementation for std::function instances, identifiable as func::target_type::std via jau::function<R(A...)>::type().
func::capref_target_t implementation for functions using a reference to a captured value, identifiable as func::target_type::capref via jau::function<R(A...)>::type().
func::capval_target_t implementation for functions using a copy of a captured value, identifiable as func::target_type::capval via jau::function<R(A...)>::type().
func::ylambda_target_t is a Y combinator and deducing this implementation for lambda closures usable for recursive algorithms.
func::lambda_target_t implementation for lambda closures, identifiable as func::target_type::lambda via jau::function<R(A...)>::type().
func::free_target_t implementation for free functions, identifiable as func::target_type::free via jau::function<R(A...)>::type().
func::member_target_t implementation for class member functions, identifiable as func::target_type::member via jau::function<R(A...)>::type().
func::null_target_t implementation for no function.
This static polymorphic target function delegate_t<R, A...> is contained by function<R(A...)> and completely holds up to 32 bytes sized TriviallyCopyable
target function objects to avoiding cache misses.
TriviallyCopyable
target function objectstarget_func_t
for callback- and equality-function, as well as for size
, type
and optional non_trivial_t
non_trivial_t
optionally holds constructor and destructor for non-trivial function data, a static target-type resourceR | function return type |
A | function arguments |
identifiable as jau::func::target_type::null via jau::function<R(A...)>::type().
This special type is used for an empty jau::function instance w/o holding a function, e.g. when created with the default constructor.
R | function return type |
A | function arguments |
R | function return type |
C0 | class type holding the member-function |
C1 | class derived from C0 or C0 of this base-pointer used to invoke the member-function |
A | function arguments |
R | function return type |
A | function arguments |
R | function return type |
L | typename holding the lambda closure |
A | function arguments |
The Y combinator allows passing the unnamed lambda instance itself, enabling recursive invocation from within the lambda.
In other words, a this
reference of the unnamed lambda is passed to the lambda, similar to Deducing this
.
The ylambda function<R(A...)> is invoked w/o explicitly passing the object parameter, as it is implicitly passed down to the user's lambda implementation.
Example implementing a recursive lambda factorial function
An instance is identifiable as func::target_type::ylambda via jau::function<R(A...)>::type().
R | function return type |
L | typename holding the lambda closure |
A | function arguments |
R | function return type |
I | typename holding the captured data used by the function |
A | function arguments |
Notable, instance is holding a unique uint64_t identifier to allow implementing the equality operator, not supported by std::function.
R | function return type |
A | function arguments |
Definition at line 380 of file functional.hpp.
typedef jau::nsize_t jau::func::final_opt< R, A >::size_type |
Utilize a natural size type jau::nsize_t.
Definition at line 383 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 726 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 764 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 871 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 919 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 1009 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 1067 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 1125 of file functional.hpp.
typedef delegate_t<R, A...> jau::func::final_opt< R, A >::delegate_type |
Definition at line 1179 of file functional.hpp.
|
inlinenoexcept |
Definition at line 541 of file functional.hpp.
|
inlinestaticconstexpr |
Definition at line 386 of file functional.hpp.
|
inlinestaticconstexpr |
Definition at line 391 of file functional.hpp.
|
inlinestaticconstexpr |
Definition at line 396 of file functional.hpp.
|
inlinestaticconstexpr |
Definition at line 401 of file functional.hpp.
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Definition at line 484 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 494 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 504 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 514 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 519 of file functional.hpp.
|
inlinenoexcept |
Definition at line 543 of file functional.hpp.
|
inlinenoexcept |
Definition at line 562 of file functional.hpp.
|
inlinenoexcept |
Definition at line 584 of file functional.hpp.
|
inlinenoexcept |
Definition at line 629 of file functional.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Definition at line 664 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 670 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 675 of file functional.hpp.
|
inlineconstexpr |
Delegated fast path target function invocation, see above.
args | target function arguments |
Definition at line 685 of file functional.hpp.
|
inlineconstexprnoexcept |
Delegated fast path target function equality operator.
rhs |
Definition at line 695 of file functional.hpp.
|
inlineconstexprnoexcept |
Returns true if the underlying target function is TriviallyCopyable
.
Definition at line 700 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 702 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 703 of file functional.hpp.
|
inlineconstexprnoexcept |
Returns the size of underlying target function.
Definition at line 706 of file functional.hpp.
|
inlineconstexprnoexcept |
Return the func::target_type of this invocation function wrapper.
Definition at line 709 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 746 of file functional.hpp.
|
inlinestaticnoexcept |
Construct a delegate_t<R, A...> instance from given this base-pointer and member-function.
This factory function is only enabled if C0 is base of C1.
base | this base-pointer of class C1 derived from C0 or C0 used to invoke the member-function |
method | member-function of class C0 |
Definition at line 853 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 902 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 955 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 1050 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 1104 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 1108 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 1160 of file functional.hpp.
|
inlinestaticnoexcept |
Definition at line 1219 of file functional.hpp.