bsl::function

Forward declaration.

Synopsis

Declared in <bslstl_function.h>

template<class PROTOTYPE>
class function
    : public BloombergLP::bslstl::Function_Variadic<PROTOTYPE>

Base Classes

NameDescription
BloombergLP::bslstl::Function_Variadic<PROTOTYPE>This component-private class template contains the physical representation and provides the variadic interfaces for bsl::function.

Type Aliases

NameDescription
allocator_type Alias for the allocator type of the function representation.

Member Functions

NameDescription
function [constructor]Constructors
operator= Assignment operators
allocator Return get_allocator().mechanism(). Note that this function exists for BDE compatibility and is not part of the C++ Standard Library.
get_allocator Return (a copy of) the allocator used to supply memory for this function.
isInplace Return true if this function is empty or if it is non-empty and its target qualifies for the small-object optimization (and is thus allocated within this object's footprint); otherwise, return false.
swap Exchange the targets held by this function and the specified other function. The behavior is undefined unless get_allocator() == other.get_allocator().
target target overloads
target_type Return typeid(void) if this object is empty; otherwise typeid(FUNC) where FUNC is the type of the target object.
operator BloombergLP::bdef_Function<PROTOTYPE*>& Return *this, converted to a mutable bdef_Function reference by downcasting. The behavior is undefined unless bdef_Function<F*> is derived from bsl::function<F> and adds no new data members.
operator BloombergLP::bslmf::NestedTraitDeclaration<function, UsesAllocatorArgT> Nested trait declaration for bslmf::UsesAllocatorArgT.
operator BloombergLP::bslmf::NestedTraitDeclaration<function, UsesBslmaAllocator> Nested trait declaration for bslma::UsesBslmaAllocator.
operator BloombergLP::bslmf::NestedTraitDeclaration<function, is_nothrow_move_constructible> Nested trait declaration for is_nothrow_move_constructible.
operator bool (C++11 and later) Return false if this object is empty, otherwise return true. Note that this is an explicit conversion operator and is typically invoked implicitly in contexts such as in the condition of an if or while statement, though it can also be invoked via an explicit cast.
operator BloombergLP::bdef_Function<PROTOTYPE*> const& Return *this converted to a const bdef_Function reference by downcasting. The behavior is undefined unless bdef_Function<F*> is derived from bsl::function<F> and adds no new data members.

Using Declarations

NameDescription
operator() If this object is empty, throw bsl::bad_function_call; otherwise invoke the target object with the specified args... and return the result (after conversion to RET). Note that, even though it is declared const, this call operator can mutate the target object and is thus considered a manipulator rather than an accessor.

Deduction Guides

NameDescription
function<PROTOTYPE> Deduce the template parameter PROTOTYPE from the signature of the operator() of the functor supplied to the constructor of function.
function<PROTOTYPE> Deduce the template parameter PROTOTYPE from the signature of the operator() of the functor supplied to the constructor of function.
function<RET(ARGS...)> Deduce the template parameter PROTOTYPE from the signature of the function supplied to the constructor of function.
function<RET(ARGS...)> Deduce the template parameter PROTOTYPE from the signature of the function supplied to the constructor of function.

Non-Member Functions

NameDescription
operator!=Return true if the specified function is not empty.
operator==Return true if the specified function argument is empty, otherwise return false.
swapExchange the targets held by the specified a and specified b objects. The behavior is undefined unless 'a.get_allocator() == b.get_allocator()'.