libstdc++
std::function< _Res(_ArgTypes...)> Class Template Reference
Inheritance diagram for std::function< _Res(_ArgTypes...)>:

List of all members.

Public Types

typedef _Res result_type

Public Member Functions

 function () noexcept
 function (nullptr_t) noexcept
 function (const function &__x)
 function (function &&__x)
template<typename _Functor >
 function (_Functor __f, typename enable_if< !is_integral< _Functor >::value, _Useless >::type=_Useless())
 operator bool () const noexcept
_Res operator() (_ArgTypes...__args) const
functionoperator= (const function &__x)
functionoperator= (function &&__x)
functionoperator= (nullptr_t)
template<typename _Functor >
enable_if<!is_integral
< _Functor >::value, function & >
::type 
operator= (_Functor &&__f)
template<typename _Functor >
enable_if<!is_integral
< _Functor >::value, function & >
::type 
operator= (reference_wrapper< _Functor > __f) noexcept
void swap (function &__x)
template<typename _Functor >
_Functor * target () noexcept
template<typename _Functor >
const _Functor * target () const noexcept
const type_infotarget_type () const noexcept

Private Types

typedef bool(* _Manager_type )(_Any_data &, const _Any_data &, _Manager_operation)

Private Member Functions

bool _M_empty () const

Private Attributes

_Any_data _M_functor
_Manager_type _M_manager

Static Private Attributes

static const std::size_t _M_max_align
static const std::size_t _M_max_size

Detailed Description

template<typename _Res, typename... _ArgTypes>
class std::function< _Res(_ArgTypes...)>

Primary class template for std::function.

Polymorphic function wrapper.

Definition at line 2025 of file functional.


Constructor & Destructor Documentation

template<typename _Res , typename... _ArgTypes>
std::function< _Res(_ArgTypes...)>::function ( )
inline

Default construct creates an empty function call wrapper.

Postcondition:
!(bool)*this

Definition at line 2042 of file functional.

template<typename _Res , typename... _ArgTypes>
std::function< _Res(_ArgTypes...)>::function ( nullptr_t  )
inline

Creates an empty function call wrapper.

Postcondition:
!(bool)*this

Definition at line 2049 of file functional.

template<typename _Res , typename... _ArgTypes>
std::function< _Res(_ArgTypes...)>::function ( const function< _Res(_ArgTypes...)> &  __x)

Function copy constructor.

Parameters:
__xA function object with identical call signature.
Postcondition:
bool(*this) == bool(__x)

The newly-created function contains a copy of the target of __x (if it has one).

Definition at line 2275 of file functional.

template<typename _Res , typename... _ArgTypes>
std::function< _Res(_ArgTypes...)>::function ( function< _Res(_ArgTypes...)> &&  __x)
inline

Function move constructor.

Parameters:
__xA function object rvalue with identical call signature.

The newly-created function contains the target of __x (if it has one).

Definition at line 2069 of file functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
std::function< _Res(_ArgTypes...)>::function ( _Functor  __f,
typename enable_if< !is_integral< _Functor >::value, _Useless >::type  = _Useless() 
)

Builds a function that targets a copy of the incoming function object.

Parameters:
__fA function object that is callable with parameters of type T1, T2, ..., TN and returns a value convertible to Res.

The newly-created function object will target a copy of __f. If __f is reference_wrapper<F>, then this function object will contain a reference to the function object __f.get(). If __f is a NULL function pointer or NULL pointer-to-member, the newly-created object will be empty.

If __f is a non-NULL function pointer or an object of type reference_wrapper<F>, this function will not throw.

Definition at line 2289 of file functional.


Member Function Documentation

template<typename _Res , typename... _ArgTypes>
std::function< _Res(_ArgTypes...)>::operator bool ( ) const
inlineexplicit

Determine if the function wrapper has a target.

Returns:
true when this function object contains a target, or false when it is empty.

This function will not throw an exception.

Definition at line 2224 of file functional.

template<typename _Res , typename... _ArgTypes>
_Res std::function< _Res(_ArgTypes...)>::operator() ( _ArgTypes...  __args) const

Invokes the function targeted by *this.

Returns:
the result of the target.
Exceptions:
bad_function_callwhen !(bool)*this

The function call operator invokes the target function object stored by this.

Definition at line 2307 of file functional.

template<typename _Res , typename... _ArgTypes>
function& std::function< _Res(_ArgTypes...)>::operator= ( const function< _Res(_ArgTypes...)> &  __x)
inline

Function assignment operator.

Parameters:
__xA function with identical call signature.
Postcondition:
(bool)*this == (bool)x
Returns:
*this

The target of __x is copied to *this. If __x has no target, then *this will be empty.

If __x targets a function pointer or a reference to a function object, then this operation will not throw an exception.

Definition at line 2111 of file functional.

template<typename _Res , typename... _ArgTypes>
function& std::function< _Res(_ArgTypes...)>::operator= ( function< _Res(_ArgTypes...)> &&  __x)
inline

Function move-assignment operator.

Parameters:
__xA function rvalue with identical call signature.
Returns:
*this

The target of __x is moved to *this. If __x has no target, then *this will be empty.

If __x targets a function pointer or a reference to a function object, then this operation will not throw an exception.

Definition at line 2129 of file functional.

template<typename _Res , typename... _ArgTypes>
function& std::function< _Res(_ArgTypes...)>::operator= ( nullptr_t  )
inline

Function assignment to zero.

Postcondition:
!(bool)*this
Returns:
*this

The target of *this is deallocated, leaving it empty.

Definition at line 2143 of file functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
enable_if<!is_integral<_Functor>::value, function&>::type std::function< _Res(_ArgTypes...)>::operator= ( _Functor &&  __f)
inline

Function assignment to a new target.

Parameters:
__fA function object that is callable with parameters of type T1, T2, ..., TN and returns a value convertible to Res.
Returns:
*this

This function object wrapper will target a copy of __f. If __f is reference_wrapper<F>, then this function object will contain a reference to the function object __f.get(). If __f is a NULL function pointer or NULL pointer-to-member, this object will be empty.

If __f is a non-NULL function pointer or an object of type reference_wrapper<F>, this function will not throw.

Definition at line 2172 of file functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
enable_if<!is_integral<_Functor>::value, function&>::type std::function< _Res(_ArgTypes...)>::operator= ( reference_wrapper< _Functor >  __f)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2181 of file functional.

template<typename _Res , typename... _ArgTypes>
void std::function< _Res(_ArgTypes...)>::swap ( function< _Res(_ArgTypes...)> &  __x)
inline

Swap the targets of two function objects.

Parameters:
__xA function with identical call signature.

Swap the targets of this function object and __f. This function will not throw an exception.

Definition at line 2196 of file functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
_Functor * std::function< _Res(_ArgTypes...)>::target ( )

Access the stored target function object.

Returns:
Returns a pointer to the stored target function object, if typeid(Functor).equals(target_type()); otherwise, a NULL pointer.

This function will not throw an exception.

Definition at line 2334 of file functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
const _Functor * std::function< _Res(_ArgTypes...)>::target ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2353 of file functional.

template<typename _Res , typename... _ArgTypes>
const type_info & std::function< _Res(_ArgTypes...)>::target_type ( ) const

Determine the type of the target of this function object wrapper.

Returns:
the type identifier of the target function object, or typeid(void) if !(bool)*this.

This function will not throw an exception.

Definition at line 2318 of file functional.


The documentation for this class was generated from the following file: