Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
|
Class template jau::function is a general-purpose static-polymorphic function wrapper. More...
#include <functional.hpp>
Public Types | |
typedef func::delegate_t< R, A... > | delegate_type |
The delegated target function type, i.e. More... | |
typedef R | result_type |
The target function return type R. More... | |
typedef R | result_type |
The target function return type R. More... | |
typedef func::target_t< R, A... > | target_type |
The target function type, i.e. More... | |
Public Member Functions | |
function () noexcept | |
Null function constructor. More... | |
function () noexcept | |
Null function constructor. More... | |
template<typename C0 , typename C1 > | |
function (C1 *base, R(C0::*mfunc)(A...)) noexcept | |
Member function constructor. More... | |
template<typename C0 , typename C1 > | |
function (C1 *base, R(C0::*mfunc)(A...)) noexcept | |
Member function constructor. More... | |
function (const function &o) noexcept=default | |
function (const function &o) noexcept=default | |
template<typename I > | |
function (const I &data, R(*func)(I &, A...)) noexcept | |
Capture by value (copy) function constructor. More... | |
template<typename I > | |
function (const I &data, R(*func)(I &, A...)) noexcept | |
Capture by value (copy) function constructor. More... | |
function (delegate_type _delegate, int dummy) noexcept | |
Internally used delegate_t<R(A...)> constructor. More... | |
function (function &&o) noexcept=default | |
function (function &&o) noexcept=default | |
template<typename I > | |
function (I &&data, R(*func)(I &, A...)) noexcept | |
Capture by value (move) function constructor. More... | |
template<typename I > | |
function (I &&data, R(*func)(I &, A...)) noexcept | |
Capture by value (move) function constructor. More... | |
template<typename I > | |
function (I *data_ptr, R(*func)(I *, A...)) noexcept | |
Capture by-reference function constructor. More... | |
template<typename I > | |
function (I *data_ptr, R(*func)(I *, A...)) noexcept | |
Capture by reference function constructor. More... | |
template<typename L , std::enable_if_t<!std::is_same_v< L, std::shared_ptr< delegate_type > > &&!std::is_pointer_v< L > &&!std::is_same_v< L, R(A...)> &&!std::is_same_v< L, function< R(A...)> >, bool > = true> | |
function (L func) noexcept | |
Lambda function constructor. More... | |
template<typename L , std::enable_if_t<!std::is_same_v< L, std::shared_ptr< target_type > > &&!std::is_pointer_v< L > &&!std::is_same_v< L, R(A...)> &&!std::is_same_v< L, function< R(A...)> >, bool > = true> | |
function (L func) noexcept | |
Lambda function constructor. More... | |
function (R(*func)(A...)) noexcept | |
Free function constructor. More... | |
function (R(*func)(A...)) noexcept | |
Free function constructor. More... | |
function (std::nullptr_t) noexcept | |
Null function constructor. More... | |
function (std::nullptr_t) noexcept | |
Null function constructor. More... | |
function (std::shared_ptr< target_type > _funcPtr, size_t asize_) noexcept | |
target_type constructor More... | |
function (uint64_t id, std::function< R(A...)> func) noexcept | |
std::function constructor More... | |
function (uint64_t id, std::function< R(A...)> func) noexcept | |
std::function constructor More... | |
constexpr bool | is_null () const noexcept |
Returns true if this instance does not hold a callable target function, i.e. More... | |
constexpr bool | is_null () const noexcept |
Returns true if this instance does not hold a callable target function, i.e. More... | |
constexpr bool | is_target_trivially_copyable () const noexcept |
Returns true if the underlying target function is TriviallyCopyable . More... | |
constexpr | operator bool () const noexcept |
Returns true if this instance holds a callable target function, i.e. More... | |
constexpr | operator bool () const noexcept |
Returns true if this instance holds a callable target function, i.e. More... | |
constexpr bool | operator!= (const function< R(A...)> &rhs) const noexcept |
constexpr bool | operator!= (const function< R(A...)> &rhs) const noexcept |
constexpr R | operator() (A... args) |
constexpr R | operator() (A... args) |
constexpr R | operator() (A... args) const |
constexpr R | operator() (A... args) const |
function & | operator= (const function &o) noexcept=default |
function & | operator= (const function &o) noexcept=default |
function & | operator= (function &&o) noexcept=default |
function & | operator= (function &&o) noexcept=default |
constexpr bool | operator== (const function< R(A...)> &rhs) const noexcept |
constexpr bool | operator== (const function< R(A...)> &rhs) const noexcept |
jau::type_info | signature () const noexcept |
Returns signature of this function prototype R(A...) w/o underlying target function object. More... | |
jau::type_info | signature () const noexcept |
Returns signature of this function prototype R(A...) w/o underlying target function details. More... | |
constexpr size_t | size () const noexcept |
Return the total size of this instance, may include heap allocated by delegate for bigger target functions. More... | |
constexpr size_t | target_size () const noexcept |
Returns the size of underlying target function. More... | |
constexpr size_t | target_size () const noexcept |
Returns the size of the target type More... | |
std::string | toString () const |
Return a string representation of this instance. More... | |
std::string | toString () const |
constexpr func::target_type | type () const noexcept |
Return the jau::func::type of this instance. More... | |
constexpr func::target_type | type () const noexcept |
Return the jau::func::type of this instance. More... | |
Static Public Member Functions | |
template<typename L > | |
static function< R(A...)> | bind_lambda (L func) noexcept |
Lambda function bind factory. More... | |
template<typename L > | |
static function< R(A...)> | bind_ylambda (L func) noexcept |
Y combinator Lambda function bind factory. More... | |
Class template jau::function is a general-purpose static-polymorphic function wrapper.
Class template jau::function is a general-purpose polymorphic function wrapper.
See Function Overview.
R | function return type |
A | function arguments |
Definition at line 1224 of file functional.hpp.
typedef func::delegate_t<R, A...> jau::function< R(A...)>::delegate_type |
The delegated target function type, i.e.
func::delegate_t<R, A...>
Definition at line 1227 of file functional.hpp.
typedef R jau::function< R(A...)>::result_type |
The target function return type R.
Definition at line 1234 of file functional.hpp.
typedef func::target_t<R, A...> jau::function< R(A...)>::target_type |
The target function type, i.e.
func::target_t<R, A...>
Definition at line 619 of file functional2.hpp.
typedef R jau::function< R(A...)>::result_type |
The target function return type R.
Definition at line 627 of file functional2.hpp.
|
inlinenoexcept |
Null function constructor.
Constructs an instance with a null target function.
Definition at line 1244 of file functional.hpp.
|
inlinenoexcept |
Null function constructor.
Constructs an instance with a null target function.
Definition at line 1256 of file functional.hpp.
|
inlineexplicitnoexcept |
Internally used delegate_t<R(A...)> constructor.
May utilize copy elision and/or named return value optimization (NRVO).
Definition at line 1269 of file functional.hpp.
|
inlinenoexcept |
Free function constructor.
Constructs an instance by taking a free target function, which may also be a non-capturing lambda if explicitly bind_free().
Definition at line 1281 of file functional.hpp.
|
inlinenoexcept |
Lambda function constructor.
Constructs an instance by taking a lambda function.
L | typename holding the lambda closure |
func | the lambda reference |
Definition at line 1302 of file functional.hpp.
|
inlinenoexcept |
Member function constructor.
Constructs an instance by taking a member target function.
C0 | class type holding the member-function |
C1 | class derived from C0 or C0 of this base-pointer used to invoke the member-function |
base | pointer to the class instance of the member function |
mfunc | member function of class |
Definition at line 1357 of file functional.hpp.
|
inlinenoexcept |
Capture by value (copy) function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data | data type instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 1379 of file functional.hpp.
|
inlinenoexcept |
Capture by value (move) function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data | data type instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 1401 of file functional.hpp.
|
inlinenoexcept |
Capture by-reference function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data_ptr | data type reference to instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 1421 of file functional.hpp.
|
inlinenoexcept |
std::function constructor
Constructs an instance by copying the 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.
func | free-function with R return value and A... arguments. |
Definition at line 1439 of file functional.hpp.
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
Null function constructor.
Constructs an instance with a null target function.
Definition at line 637 of file functional2.hpp.
|
inlinenoexcept |
Null function constructor.
Constructs an instance with a null target function.
Definition at line 650 of file functional2.hpp.
|
inlineexplicitnoexcept |
target_type constructor
Constructs an instance with the given shared target function pointer.
Definition at line 663 of file functional2.hpp.
|
inlinenoexcept |
Free function constructor.
Constructs an instance by taking a free target function, which may also be a non-capturing lambda if explicitly bind_free().
Definition at line 676 of file functional2.hpp.
|
inlinenoexcept |
Lambda function constructor.
Constructs an instance by taking a lambda function.
L | typename holding the lambda closure |
func | the lambda reference |
Definition at line 697 of file functional2.hpp.
|
inlinenoexcept |
Member function constructor.
Constructs an instance by taking a member target function.
C0 | class type holding the member-function |
C1 | class derived from C0 or C0 of this base-pointer used to invoke the member-function |
base | pointer to the class instance of the member function |
mfunc | member function of class |
Definition at line 715 of file functional2.hpp.
|
inlinenoexcept |
Capture by value (copy) function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data | data type instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 738 of file functional2.hpp.
|
inlinenoexcept |
Capture by value (move) function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data | data type instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 761 of file functional2.hpp.
|
inlinenoexcept |
Capture by reference function constructor.
Constructs an instance 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.
I | typename holding the captured data used by the function |
data_ptr | data type reference to instance holding the captured data |
func | function with R return value and A... arguments. |
Definition at line 782 of file functional2.hpp.
|
inlinenoexcept |
std::function constructor
Constructs an instance by copying the 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.
func | free-function with R return value and A... arguments. |
Definition at line 801 of file functional2.hpp.
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinestaticnoexcept |
Lambda function bind factory.
Constructs an instance by taking a lambda function.
L | typename holding the lambda closure |
func | the lambda reference |
Definition at line 1318 of file functional.hpp.
|
inlinestaticnoexcept |
Y combinator Lambda function bind factory.
Constructs an instance by taking a lambda function, implementing a Y combinator and deducing this lambda closure, see ylambda_target_t.
L | typename holding the lambda closure |
func | the lambda reference |
Definition at line 1339 of file functional.hpp.
|
defaultnoexcept |
|
defaultnoexcept |
|
inlineconstexprnoexcept |
Return the jau::func::type of this instance.
Definition at line 1449 of file functional.hpp.
|
inlineconstexprnoexcept |
Returns true if this instance does not hold a callable target function, i.e.
is of func::target_type::null.
Definition at line 1452 of file functional.hpp.
|
inlineexplicitconstexprnoexcept |
Returns true if this instance holds a callable target function, i.e.
is not of func::target_type::null.
Definition at line 1455 of file functional.hpp.
|
inlinenoexcept |
Returns signature of this function prototype R(A...) w/o underlying target function object.
Definition at line 1458 of file functional.hpp.
|
inlineconstexprnoexcept |
Returns true if the underlying target function is TriviallyCopyable
.
Definition at line 1463 of file functional.hpp.
|
inlineconstexprnoexcept |
Return the total size of this instance, may include heap allocated by delegate for bigger target functions.
Definition at line 1466 of file functional.hpp.
|
inlineconstexprnoexcept |
Returns the size of underlying target function.
Definition at line 1469 of file functional.hpp.
|
inline |
Return a string representation of this instance.
The string representation contains the complete signature and detailed memory footprint.
Definition at line 1475 of file functional.hpp.
|
inlineconstexpr |
Definition at line 1484 of file functional.hpp.
|
inlineconstexpr |
Definition at line 1487 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 1491 of file functional.hpp.
|
inlineconstexprnoexcept |
Definition at line 1494 of file functional.hpp.
|
defaultnoexcept |
|
defaultnoexcept |
|
inlineconstexprnoexcept |
Return the jau::func::type of this instance.
Definition at line 812 of file functional2.hpp.
|
inlineconstexprnoexcept |
Returns true if this instance does not hold a callable target function, i.e.
is of func::target_type::null.
Definition at line 815 of file functional2.hpp.
|
inlineexplicitconstexprnoexcept |
Returns true if this instance holds a callable target function, i.e.
is not of func::target_type::null.
Definition at line 818 of file functional2.hpp.
|
inlinenoexcept |
Returns signature of this function prototype R(A...) w/o underlying target function details.
Definition at line 821 of file functional2.hpp.
|
inlineconstexprnoexcept |
Returns the size of the target type
Definition at line 826 of file functional2.hpp.
|
inline |
Definition at line 828 of file functional2.hpp.
|
inlineconstexpr |
Definition at line 836 of file functional2.hpp.
|
inlineconstexpr |
Definition at line 839 of file functional2.hpp.
|
inlineconstexprnoexcept |
Definition at line 843 of file functional2.hpp.
|
inlineconstexprnoexcept |
Definition at line 846 of file functional2.hpp.