Constructors
Declared in <bslstl_function.h>
Create an empty function that does not target any callable.
function() noexcept;
» more...
Create a function having the same value as (i.e., wrapping a copy of the target held by) the specified original object. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.
function(function const& original);
» more...
Create an empty function that does not target any callable.
function(nullptr_t) noexcept;
» more...
Create a function having the same target as the specified original object. Use original.get_allocator() as the allocator to supply memory. The original object is set to empty after the new object is created. If the target qualifies for the small-object optimization (see class-level documentation), then it is move-constructed into the new object; otherwise ownership of the target is transferred without using the target's move constructor.
function(BloombergLP::bslmf::MovableRef<function> original) noexcept;
» more...
Create an object wrapping the specified func callable object. Use the default allocator to supply memory. If func is a null pointer or null pointer-to-member, then the resulting object will be empty. This constructor will not participate in overload resolution if func is of the same type as (or reference compatible with) this object (to avoid ambiguity with the copy and move constructors) or is an integral type (to avoid matching null pointer literals). In C++03, this function will not participate in overload resolution if FUNC is a MovableRef (see overload, below), and instantiation will fail unless FUNC is invocable using the arguments and return type specified in PROTOTYPE. In C++11 and later, this function will not participate in overload resolution if FUNC is not invocable using the arguments and return type specified in PROTOTYPE. Note that this constructor implicitly converts from any type that is so invocable.
template<class FUNC>
function(FUNC&& func)
requires ! IsReferenceCompatible<typename Decay<FUNC>::type,
function>::value
&& IsInvocableWithPrototype<
typename Decay<FUNC>::type>::value;
» more...
Create an empty function object using the specified allocator (e.g., the address of a bslma::Allocator object) to supply memory.
function(
std::allocator_arg_t,
allocator_type const& allocator) noexcept;
» more...
Create an empty function object. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.
function(
std::allocator_arg_t,
allocator_type const& allocator,
nullptr_t) noexcept;
» more...
Create a function having the same value as (i.e., wrapping a copy of the target held by) the specified original object. Use the specified allocator (e.g., the address of a bslma::Allocator object) to supply memory. If allocator == original.allocator(), this object is created as if by move construction; otherwise it is created as if by extended copy construction using allocator.
function(
std::allocator_arg_t,
allocator_type const& allocator,
BloombergLP::bslmf::MovableRef<function> original);
» more...
Create a function having the same value as the specified original object, using the specified allocator to supply memory.
function(
std::allocator_arg_t,
allocator_type const& allocator,
function const& original);
» more...
Create an object wrapping the specified func callable object. Use the specified allocator (i.e., the address of a bslma::Allocator object) to supply memory. If func is a null pointer or null pointer-to-member, then the resulting object will be empty. This constructor will not participate in overload resolution if func is of the same type as (or reference compatible with) this object (to avoid ambiguity with the extended copy and move constructors) or is an integral type (to avoid matching null pointer literals). In C++03, this function will not participate in overload resolution if FUNC is a MovableRef (see overload, below), and instantiation will fail unless FUNC is invocable using the arguments and return type specified in PROTOTYPE. In C++11 and later, this function will not participate in overload resolution if FUNC is not invocable using the arguments and return type specified in PROTOTYPE. Note that this constructor implicitly converts from any type that is so invocable.
template<class FUNC>
function(
std::allocator_arg_t,
allocator_type const& allocator,
FUNC&& func)
requires ! IsReferenceCompatible<typename Decay<FUNC>::type,
function>::value
&& IsInvocableWithPrototype<
typename Decay<FUNC>::type>::value;
» more...