A general-purpose static-polymorphic function wrapper via jau::function<R(A...)>.  
More...
|  | 
| template<typename R, typename I, typename... A> | 
| jau::function< R(A...)> | jau::bind_capref (I *data_ptr, R(*func)(I *, A...)) noexcept | 
|  | Bind given data by passing the captured reference (pointer) to the value and non-void function to an anonymous function using func::capref_target_t. 
 | 
|  | 
| template<typename I, typename... A> | 
| jau::function< void(A...)> | jau::bind_capref (I *data_ptr, void(*func)(I *, A...)) noexcept | 
|  | Bind given data by passing the captured reference (pointer) to the value and void function to an anonymous function using func::capref_target_t. 
 | 
|  | 
| template<typename R, typename I, typename... A> | 
| jau::function< R(A...)> | jau::bind_capval (const I &data, R(*func)(I &, A...)) noexcept | 
|  | Bind given data by copying the captured value and the given non-void function to an anonymous function using func::capval_target_t. 
 | 
|  | 
| template<typename I, typename... A> | 
| jau::function< void(A...)> | jau::bind_capval (const I &data, void(*func)(I &, A...)) noexcept | 
|  | Bind given data by copying the captured value and the given void function to an anonymous function using func::capval_target_t. 
 | 
|  | 
| template<typename R, typename I, typename... A> | 
| jau::function< R(A...)> | jau::bind_capval (I &&data, R(*func)(I &, A...)) noexcept | 
|  | Bind given data by moving the captured value and copying the given non-void function to an anonymous function using func::capval_target_t. 
 | 
|  | 
| template<typename I, typename... A> | 
| jau::function< void(A...)> | jau::bind_capval (I &&data, void(*func)(I &, A...)) noexcept | 
|  | Bind given data by moving the captured value and copying the given void function to an anonymous function using func::capval_target_t. 
 | 
|  | 
| template<typename R, typename... A> | 
| jau::function< R(A...)> | jau::bind_free (R(*func)(A...)) noexcept | 
|  | Bind given non-void free-function to an anonymous function using func::free_target_t. 
 | 
|  | 
| template<typename... A> | 
| jau::function< void(A...)> | jau::bind_free (void(*func)(A...)) noexcept | 
|  | Bind given void free-function to an anonymous function using func::free_target_t. 
 | 
|  | 
| template<typename R, typename C, typename... A> | 
| jau::function< R(A...)> | jau::bind_member (C *base, R(C::*mfunc)(A...)) noexcept | 
|  | Bind given class instance and non-void member function to an anonymous function using func_member_targer_t. 
 | 
|  | 
| template<typename C, typename... A> | 
| jau::function< void(A...)> | jau::bind_member (C *base, void(C::*mfunc)(A...)) noexcept | 
|  | Bind given class instance and void member function to an anonymous function using func_member_targer_t. 
 | 
|  | 
| template<typename R, typename C0, typename C1, typename... A> | 
| jau::function< R(A...)> | jau::bind_member (C1 *base, R(C0::*mfunc)(A...)) noexcept | 
|  | Bind given class instance and non-void member function to an anonymous function using func_member_targer_t. 
 | 
|  | 
| template<typename C0, typename C1, typename... A> | 
| jau::function< void(A...)> | jau::bind_member (C1 *base, void(C0::*mfunc)(A...)) noexcept | 
|  | Bind given class instance and void member function to an anonymous function using func_member_targer_t. 
 | 
|  | 
| template<typename R, typename... A> | 
| jau::function< R(A...)> | jau::bind_std (uint64_t id, std::function< R(A...)> func) noexcept | 
|  | Bind given non-void std::function to an anonymous function using func::std_target_t. 
 | 
|  | 
| template<typename... A> | 
| jau::function< void(A...)> | jau::bind_std (uint64_t id, std::function< void(A...)> func) noexcept | 
|  | Bind given void std::function to an anonymous function using func::std_target_t. 
 | 
|  | 
| constexpr uint32_t | jau::number (const func::target_type rhs) noexcept | 
|  | 
| template<class R, class... A> | 
| bool | jau::operator!= (const function< R(A...)> &lhs, std::nullptr_t) noexcept | 
|  | Unequal operator of jau::function<R(A...)> with a right-hand-side nullptr. 
 | 
|  | 
| template<typename Rl, typename... Al, template< typename... > typename Fl = function, typename Rr, typename... Ar, template< typename... > typename Fr = function> | 
| bool | jau::operator!= (const function< Rl(Al...)> &lhs, const function< Rr(Ar...)> &rhs) noexcept | 
|  | Unequal operator using two jau::function<R(A...)> types for both arguments. 
 | 
|  | 
| template<class R, class... A> | 
| bool | jau::operator!= (std::nullptr_t, const function< R(A...)> &rhs) noexcept | 
|  | Unequal operator of jau::function<R(A...)> with a left-hand-side nullptr. 
 | 
|  | 
| template<class R, class... A> | 
| bool | jau::operator== (const function< R(A...)> &lhs, std::nullptr_t) noexcept | 
|  | Equal operator of jau::function<R(A...)> with a right-hand-side nullptr. 
 | 
|  | 
| template<typename Rl, typename... Al, template< typename... > class Fl = function, typename Rr, typename... Ar, template< typename... > class Fr = function, std::enable_if_t< !std::is_same_v< Fl< Rl(Al...)>, Fr< Rr(Ar...)> >, bool > = true> | 
| bool | jau::operator== (const function< Rl(Al...)> &lhs, const function< Rr(Ar...)> &rhs) noexcept | 
|  | Equal operator using different jau::function<R(A...)> return and argument types for both arguments, always returns false. 
 | 
|  | 
| template<class R, class... A> | 
| bool | jau::operator== (std::nullptr_t, const function< R(A...)> &rhs) noexcept | 
|  | Equal operator of jau::function<R(A...)> with a left-hand-side nullptr. 
 | 
|  | 
| std::string | jau::to_string (const func::target_type v) noexcept | 
|  | 
A general-purpose static-polymorphic function wrapper via jau::function<R(A...)>. 
Function Overview
Similar to std::function, jau::function<R(A...)> stores any callable target function solely described by its return type R and arguments types A... from any source, e.g. free functions, capturing and non-capturing lambda function, member functions.
jau::function<R(A...)> supports equality operations for all func::target_type source types, allowing to manage container of jau::functions, see limitations below.
If a jau::function contains no target, see jau::function<R(A...)>::is_null(), it is empty. Invoking the target of an empty jau::function is a no-operation and has no side effects.
jau::function satisfies the requirements of CopyConstructible, CopyAssignable, MoveConstructible and MoveAssignable.
Compared to std::function<R(A...)>, jau::function<R(A...)>
Instances of jau::function can store, copy, move and invoke any of its callable targets
Implementation Details
jau::function<R(A...)> holds the static polymorphic target function delegate_t<R, A...>,
 which itself completely holds up to 32 bytes sized TriviallyCopyable target function objects to avoiding cache misses.
The following table shows the full memory footprint of the target function delegate_t<R, A...> storage,
 which equals to jau::function<R(A...)> memory size as it only contains the instance of delegate_t<R, A...>.
| Type | Signature | Target Function Size | delegate_t<R, A...>Size | Heap Size | Total Size | TriviallyCopyable | 
| free | function<free, void ()> | 8 | 40 | 0 | 40 | true | 
| member | function<member, int (int)> | 16 | 40 | 0 | 40 | true | 
| lambda_plain | function<lambda, int (int)> | 32 | 40 | 0 | 40 | true | 
| lambda_ref | function<lambda, int (int)> | 32 | 40 | 0 | 40 | true | 
| lambda_copy | function<lambda, int (int)> | 32 | 40 | 0 | 40 | true | 
| ylambda_plain | function<ylambda, int (int)> | 32 | 40 | 0 | 40 | true | 
| capval (small) | function<capval, int (int)> | 16 | 40 | 0 | 40 | true | 
| capval (big) | function<capval, int (int)> | 48 | 40 | 48 | 88 | true | 
| capref | function<capref, int (int)> | 16 | 40 | 0 | 40 | true | 
Memory sizes are in bytes, data collected on a GNU/Linux arm64 system.
The detailed memory footprint can queried at runtime, see implementation of jau::function<R(A...)>::function::toString().
Static polymorphism is achieved by constructing the delegate_t<R, A...> instance via their func::target_type specific factories, see mapping at func::target_type.
For example the static func::member_target_t::delegate constructs its specific delegate_t<R, A...> by passing its data and required functions to func::delegate_t<R, A...>::make.
 The latter is an overloaded template for trivial and non-trivial types and decides which memory is being used, e.g. the internal 32 bytes memory cache or heap if not fitting.
To support lambda identity for the equality operator, jau::type_info is being used either with Runtime Type Information (RTTI) if enabled or using Compile time type information (CTTI), see limitations below.
Function Usage
A detailed API usage is covered within test_functional.hpp and test_functional_perf.hpp, see function test00_usage().
Let's assume we like to bind to the following function prototype bool func(int), which results to jau::function<bool(int)>:
- Free functions via constructor and jau::bind_free()
- Prologue typedef bool(*cfunc)(int);    bool my_func(int v) { return 0 == v; }   struct MyClass {    static bool func(int v) { return 0 == v; } }; 
- Constructor function(R(*func)(A...)) 
            return 0 == v;     } ); Class template jau::function is a general-purpose static-polymorphic function wrapper. 
 
- Factory jau::bind_free(R(*func)(A...))
  jau::function< R(A...)> bind_free(R(*func)(A...)) noexcept Bind given non-void free-function to an anonymous function using func::free_target_t. 
 
 
- Class member functions via constructor and jau::bind_member()
- Prologue struct MyClass {    bool m_func(int v) { return 0 == v; } }; MyClass i1; 
- Constructor function(C *base, R(C::*mfunc)(A...)) 
- Factory jau::bind_member(C *base, R(C::*mfunc)(A...))
jau::function< R(A...)> bind_member(C1 *base, R(C0::*mfunc)(A...)) noexcept Bind given class instance and non-void member function to an anonymous function using func_member_tar... 
 
 
- Lambda functions via constructor
- Prologue 
- Stateless lambda, equivalent to bool(*)(int)function
- Stateless by-value capturing lambda 
- Stateful by-value capturing lambda mutating captured field 
        sum += v;         return 0 == v;     }; 
 
- Stateless by-reference capturing lambda 
        sum += v;         return 0 == v;     }; 
 
- Stateless by-reference capturing lambda assigning an auto lambda auto lambda_func = [&](int v) -> bool {         sum += v;         return 0 == v;     };   assert( func1 == func2 ); 
 
- Y combinator and deducing this lambda functions via factory bind_ylambda()
- Stateless lambda receiving explicit this object parameter reference used for recursion using autofunction<int(int)> f = function<int(int)>::bind_ylambda( [](auto& self, int x) -> int {     if( 0 == x ) {         return 1;     } else {         return x * self(x-1);      } } ); assert( 24 == f(4) );  
- or using explicit function<R(A...)>::delegate_typefunction<int(int)> f = function<int(int)>::bind_ylambda( [](function<int(int)>::delegate_type& self, int x) -> int {     if( 0 == x ) {         return 1;     } else {         return x * self(x-1);      } } ); assert( 24 == f(4) );  
 
- Lambda alike capture by-reference to value via constructor and jau::bind_capref()
- Prologue struct big_data {     int sum; }; big_data data { 0 };   typedef bool(*cfunc)(big_data*, int);  
- Constructor function(I* data_ptr, R(func)(I, A...)) function<int(int)> func(&data,     (cfunc) ( [](big_data* data, int v) -> bool {               stats_ptr->sum += v;               return 0 == v;           } ) ); 
- Factory jau::bind_capref(I* data_ptr, R(*func)(I*, A...))
    (cfunc) ( [](big_data* data, int v) -> bool {               stats_ptr->sum += v;               return 0 == v;           } ) ); jau::function< R(A...)> bind_capref(I *data_ptr, R(*func)(I *, A...)) noexcept Bind given data by passing the captured reference (pointer) to the value and non-void function to an ... 
 
 
- Lambda alike capture by-copy of value via constructor and jau::bind_capval()
- std::function function via constructor and jau::bind_std()
- Prologue std::function<bool(int)> func_stdlambda = [](int i)->bool {     return 0 == i; }; 
- Constructor function(uint64_t id, std::function<R(A...)> func) 
- Factory jau::bind_std(uint64_t id, std::function<R(A...)> func)
jau::function< R(A...)> bind_std(uint64_t id, std::function< R(A...)> func) noexcept Bind given non-void std::function to an anonymous function using func::std_target_t. 
 
 
Function Limitations
Non unique lambda type names without RTTI using gcc or non clang compiler
Due to limitations of jau::make_ctti<R, L, A...>(), not using RTTI on gcc or non clang compiler will erroneously mistake different lambda functions defined within one function and using same function prototype R<A...> to be the same.
jau::type_info::limited_lambda_id will expose the potential limitation.
See CTTI lambda name limitations and limitations of jau::type_info. 
◆ target_type
func::target_type identifier for the target function delegate_t<R, A...> object, exposed by jau::function<R(A...)>::type(). 
- See also
- Function Overview 
| Enumerator | 
|---|
| null | Denotes a func::null_target_t.  | 
| member | Denotes a func::member_target_t.  | 
| free | Denotes a func::free_target_t.  | 
| lambda | Denotes a func::lambda_target_t.  | 
| ylambda | Denotes a func::ylambda_target_t.  | 
| capval | Denotes a func::capval_target_t.  | 
| capref | Denotes a func::capref_target_t.  | 
| std | Denotes a func::std_target_t.  | 
Definition at line 342 of file functional.hpp.
 
 
◆ number()
◆ to_string()
◆ operator==() [1/3]
template<typename Rl, typename... Al, template< typename... > class Fl = function, typename Rr, typename... Ar, template< typename... > class Fr = function, std::enable_if_t< !std::is_same_v< Fl< Rl(Al...)>, Fr< Rr(Ar...)> >, bool > = true> 
  
  | 
        
          | bool jau::operator== | ( | const function< Rl(Al...)> & | lhs, |  
          |  |  | const function< Rr(Ar...)> & | rhs ) |  | noexcept | 
 
Equal operator using different jau::function<R(A...)> return and argument types for both arguments, always returns false. 
Equal operator using same jau::function<R(A...)> return and argument types for both arguments, returning actual result of equality operation.
- Template Parameters
- 
  
    | Rl | left function return type |  | Al | left function arguments |  | Fl | left function Fl<Rl(<Al...)> |  | Rr | right function return type |  | Ar | right function arguments |  | Fr | right function Fr<Rr(<Ar...)> |  
 
- Parameters
- 
  
    | lhs | left function Fl<Rl(<Al...)> |  | rhs | right function Fr<Rr(<Ar...)> |  
 
- Returns
- false 
- See also
- function Overview 
- 
function Usage
- Template Parameters
- 
  
    | Rl | left function return type |  | Al | left function arguments |  | Fl | left function Fl<Rl(<Al...)> |  | Rr | right function return type |  | Ar | right function arguments |  | Fr | right function Fr<Rr(<Ar...)> |  
 
- Parameters
- 
  
    | lhs | left function Fl<Rl(<Al...)> |  | rhs | right function Fr<Rr(<Ar...)> |  
 
- Returns
- equality result of same type functions 
- See also
- function Overview 
- 
function Usage 
Definition at line 1549 of file functional.hpp.
 
 
◆ operator!=() [1/3]
template<typename Rl, typename... Al, template< typename... > typename Fl = function, typename Rr, typename... Ar, template< typename... > typename Fr = function> 
 
Unequal operator using two jau::function<R(A...)> types for both arguments. 
- Template Parameters
- 
  
    | Rl | left function return type |  | Al | left function arguments |  | Fl | left function Fl<Rl(<Al...)> |  | Rr | right function return type |  | Ar | right function arguments |  | Fr | right function Fr<Rr(<Ar...)> |  
 
- Parameters
- 
  
    | lhs | left function Fl<Rl(<Al...)> |  | rhs | right function Fr<Rr(<Ar...)> |  
 
- Returns
- unequality result of same type functions 
- See also
- function Overview 
- 
function Usage 
Definition at line 1594 of file functional.hpp.
 
 
◆ operator==() [2/3]
template<class R, class... A> 
  
  | 
        
          | bool jau::operator== | ( | const function< R(A...)> & | lhs, |  
          |  |  | std::nullptr_t | ) |  | noexcept | 
 
Equal operator of jau::function<R(A...)> with a right-hand-side nullptr. 
- Template Parameters
- 
  
    | R | left function return type |  | A | left function arguments |  
 
- Parameters
- 
  
  
- Returns
- true if function instance contains no function, i.e. !lhsnegated function bool operator.
Definition at line 1605 of file functional.hpp.
 
 
◆ operator!=() [2/3]
template<class R, class... A> 
 
Unequal operator of jau::function<R(A...)> with a right-hand-side nullptr. 
- Template Parameters
- 
  
    | R | left function return type |  | A | left function arguments |  
 
- Parameters
- 
  
  
- Returns
- true if function instance contains a function, i.e. lhsfunction bool operator.
Definition at line 1616 of file functional.hpp.
 
 
◆ operator==() [3/3]
template<class R, class... A> 
  
  | 
        
          | bool jau::operator== | ( | std::nullptr_t | , |  
          |  |  | const function< R(A...)> & | rhs ) |  | noexcept | 
 
Equal operator of jau::function<R(A...)> with a left-hand-side nullptr. 
- Template Parameters
- 
  
    | R | right function return type |  | A | right function arguments |  
 
- Parameters
- 
  
  
- Returns
- true if function instance contains no function, i.e. !lhsnegated function bool operator.
Definition at line 1627 of file functional.hpp.
 
 
◆ operator!=() [3/3]
template<class R, class... A> 
 
Unequal operator of jau::function<R(A...)> with a left-hand-side nullptr. 
- Template Parameters
- 
  
    | R | right function return type |  | A | right function arguments |  
 
- Parameters
- 
  
  
- Returns
- true if function instance contains a function, i.e. lhsfunction bool operator.
Definition at line 1638 of file functional.hpp.
 
 
◆ bind_member() [1/4]
template<typename R, typename C0, typename 
C1, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_member | ( | C1 * | base, |  
          |  |  | R(C0::* | mfunc )(A...) ) |  | inlinenoexcept | 
 
Bind given class instance and non-void member function to an anonymous function using func_member_targer_t. 
- Template Parameters
- 
  
    | 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 |  
 
- Parameters
- 
  
    | base | class instance thispointer |  | mfunc | member-function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for member function 
- 
function Overview 
- 
function Usage 
- Examples
- test_functional_perf.hpp.
Definition at line 1658 of file functional.hpp.
 
 
◆ bind_member() [2/4]
template<typename R, typename C, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_member | ( | C * | base, |  
          |  |  | R(C::* | mfunc )(A...) ) |  | inlinenoexcept | 
 
Bind given class instance and non-void member function to an anonymous function using func_member_targer_t. 
- Template Parameters
- 
  
    | R | function return type |  | C | class type holding the member-function and of this base pointer |  | A | function arguments |  
 
- Parameters
- 
  
    | base | class instance thispointer |  | mfunc | member-function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for member function 
- 
function Overview 
- 
function Usage 
Definition at line 1678 of file functional.hpp.
 
 
◆ bind_member() [3/4]
template<typename C0, typename 
C1, typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_member | ( | C1 * | base, |  
          |  |  | void(C0::* | mfunc )(A...) ) |  | inlinenoexcept | 
 
Bind given class instance and void member function to an anonymous function using func_member_targer_t. 
- Template Parameters
- 
  
    | 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 |  
 
- Parameters
- 
  
    | base | class instance thispointer |  | mfunc | member-function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for member function 
- 
function Overview 
- 
function Usage 
Definition at line 1698 of file functional.hpp.
 
 
◆ bind_member() [4/4]
template<typename C, typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_member | ( | C * | base, |  
          |  |  | void(C::* | mfunc )(A...) ) |  | inlinenoexcept | 
 
Bind given class instance and void member function to an anonymous function using func_member_targer_t. 
- Template Parameters
- 
  
    | C | class type holding the member-function and of this base pointer |  | A | function arguments |  
 
- Parameters
- 
  
    | base | class instance thispointer |  | mfunc | member-function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for member function 
- 
function Overview 
- 
function Usage 
Definition at line 1717 of file functional.hpp.
 
 
◆ bind_free() [1/2]
template<typename R, typename... A> 
 
 
◆ bind_free() [2/2]
◆ bind_capval() [1/4]
template<typename R, typename I, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_capval | ( | const I & | data, |  
          |  |  | R(* | func )(I &, A...) ) |  | inlinenoexcept | 
 
Bind given data by copying the captured value and the given non-void function to an anonymous function using func::capval_target_t. 
const I& data will be copied into func::capval_target_t and hence captured by-copy.
The function invocation will have the reference of the copied data being passed to the target function for efficiency.
- Template Parameters
- 
  
    | R | function return type |  | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data | data type instance holding the captured data |  | func | function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for copying capturing value 
- 
function Overview 
- 
function Usage 
- Examples
- test_functional_perf.hpp.
Definition at line 1776 of file functional.hpp.
 
 
◆ bind_capval() [2/4]
template<typename I, typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_capval | ( | const I & | data, |  
          |  |  | void(* | func )(I &, A...) ) |  | inlinenoexcept | 
 
Bind given data by copying the captured value and the given void function to an anonymous function using func::capval_target_t. 
const I& data will be copied into func::capval_target_t and hence captured by-copy.
The function invocation will have the reference of the copied data being passed to the target function for efficiency.
- Template Parameters
- 
  
    | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data | data type instance holding the captured data |  | func | function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for copying capturing value 
- 
function Overview 
- 
function Usage 
Definition at line 1799 of file functional.hpp.
 
 
◆ bind_capval() [3/4]
template<typename R, typename I, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_capval | ( | I && | data, |  
          |  |  | R(* | func )(I &, A...) ) |  | inlinenoexcept | 
 
Bind given data by moving the captured value and copying the given non-void function to an anonymous function using func::capval_target_t. 
I&& data will be moved into func::capval_target_t.
The function invocation will have the reference of the moved data being passed to the target function for efficiency.
- Template Parameters
- 
  
    | R | function return type |  | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data | data type instance holding the captured data |  | func | function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for moving capturing value 
- 
function Overview 
- 
function Usage 
Definition at line 1823 of file functional.hpp.
 
 
◆ bind_capval() [4/4]
template<typename I, typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_capval | ( | I && | data, |  
          |  |  | void(* | func )(I &, A...) ) |  | inlinenoexcept | 
 
Bind given data by moving the captured value and copying the given void function to an anonymous function using func::capval_target_t. 
I&& data will be moved into func::capval_target_t.
The function invocation will have the reference of the moved data being passed to the target function for efficiency.
- Template Parameters
- 
  
    | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data | data type instance holding the captured data |  | func | function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for moving capturing value 
- 
function Overview 
- 
function Usage 
Definition at line 1846 of file functional.hpp.
 
 
◆ bind_capref() [1/2]
template<typename R, typename I, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_capref | ( | I * | data_ptr, |  
          |  |  | R(* | func )(I *, A...) ) |  | inlinenoexcept | 
 
Bind given data by passing the captured reference (pointer) to the value and non-void function to an anonymous function using func::capref_target_t. 
The function invocation will have the reference of the data being passed to the target function.
- Template Parameters
- 
  
    | R | function return type |  | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data_ptr | data type reference to instance holding the captured data |  | func | function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for capturing reference 
- 
function Overview 
- 
function Usage 
- Examples
- test_functional_perf.hpp.
Definition at line 1868 of file functional.hpp.
 
 
◆ bind_capref() [2/2]
template<typename I, typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_capref | ( | I * | data_ptr, |  
          |  |  | void(* | func )(I *, A...) ) |  | inlinenoexcept | 
 
Bind given data by passing the captured reference (pointer) to the value and void function to an anonymous function using func::capref_target_t. 
The function invocation will have the reference of the data being passed to the target function.
- Template Parameters
- 
  
    | I | typename holding the captured data used by the function |  | A | function arguments |  
 
- Parameters
- 
  
    | data_ptr | data type reference to instance holding the captured data |  | func | function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for capturing reference 
- 
function Overview 
- 
function Usage 
Definition at line 1889 of file functional.hpp.
 
 
◆ bind_std() [1/2]
template<typename R, typename... A> 
  
  | 
        
          | jau::function< R(A...)> jau::bind_std | ( | uint64_t | id, |  
          |  |  | std::function< R(A...)> | func ) |  | inlinenoexcept | 
 
Bind given non-void std::function to an anonymous function using func::std_target_t. 
Notable, instance is holding the given unique uint64_t identifier to allow implementing the equality operator w/o RTTI, not supported by std::function.
- Template Parameters
- 
  
    | R | function return type |  | A | function arguments |  
 
- Parameters
- 
  
    | func | free-function with Rreturn value andA...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for std::function 
- 
function Overview 
- 
function Usage 
- Examples
- test_functional_perf.hpp.
Definition at line 1910 of file functional.hpp.
 
 
◆ bind_std() [2/2]
template<typename... A> 
  
  | 
        
          | jau::function< void(A...)> jau::bind_std | ( | uint64_t | id, |  
          |  |  | std::function< void(A...)> | func ) |  | inlinenoexcept | 
 
Bind given void std::function to an anonymous function using func::std_target_t. 
Notable, instance is holding the given unique uint64_t identifier to allow implementing the equality operator w/o RTTI, not supported by std::function.
- Template Parameters
- 
  
  
- Parameters
- 
  
    | func | free-function with A...arguments. |  
 
- Returns
- anonymous function 
- See also
- function constructor for std::function 
- 
function Overview 
- 
function Usage 
Definition at line 1930 of file functional.hpp.