bsl::function::function

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.

Synopsis

Declared in <bslstl_function.h>

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;