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

Public Types

typedef _Res result_type
 

Public Member Functions

 function ()
 
 function (_M_clear_type *)
 
 function (const function &__x)
 
template<typename _Functor >
 function (_Functor __f, typename __gnu_cxx::__enable_if< !is_integral< _Functor >::value, _Useless >::__type=_Useless())
 
 operator _Safe_bool () const
 
_Res operator() (_ArgTypes...__args) const
 
functionoperator= (const function &__x)
 
functionoperator= (_M_clear_type *)
 
template<typename _Functor >
__gnu_cxx::__enable_if
<!is_integral< _Functor >
::value, function & >::__type 
operator= (_Functor __f)
 
void swap (function &__x)
 

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...)>

class function

Definition at line 1760 of file tr1_impl/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 1786 of file tr1_impl/functional.

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

Default construct creates an empty function call wrapper.

Postcondition
!(bool)*this

Definition at line 1792 of file tr1_impl/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.
Precondition
(bool)*this == (bool)x

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

Definition at line 1982 of file tr1_impl/functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
std::function< _Res(_ArgTypes...)>::function ( _Functor  __f,
typename __gnu_cxx::__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 1996 of file tr1_impl/functional.

Member Function Documentation

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

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 1921 of file tr1_impl/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 2014 of file tr1_impl/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 1839 of file tr1_impl/functional.

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

Function assignment to zero.

Postcondition
!(bool)*this
Returns
*this

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

Definition at line 1853 of file tr1_impl/functional.

template<typename _Res , typename... _ArgTypes>
template<typename _Functor >
__gnu_cxx::__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 1883 of file tr1_impl/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
fA function with identical call signature.

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

Definition at line 1898 of file tr1_impl/functional.


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