# std::tr1::function< _Res(...)> Class Template Reference

Inheritance diagram for std::tr1::function< _Res(...)>:

List of all members.

## Detailed Description

### template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
class std::tr1::function< _Res(...)>

Definition at line 595 of file functional_iterate.h.

## Public Types

- typedef _Res result_type

## Public Member Functions

- template<typename _Functor> function (_Functor __f, typename __gnu_cxx::__enable_if<!is_integral< _Functor >::value, _Useless >::__type=_Useless())
- function (const function &__x)
- function (_M_clear_type *)
- function ()
- operator _Safe_bool () const
- _Res operator() (_GLIBCXX_PARAMS) const
- template<typename _Functor> __gnu_cxx::__enable_if<!is_integral<
  _Functor >::value, function
  & >::__type operator= (_Functor __f)
- function & operator= (_M_clear_type *)
- function & operator= (const function &__x)
- void swap (function &__x)
- template<typename _Functor> const _Functor * target () const
- template<typename _Functor> _Functor * target ()
- const type_info & target_type () const

## Constructor & Destructor Documentation

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

std::tr1::function< _Res(...)>::function | ( |  | ) | `[inline]`

Default construct creates an empty function call wrapper.

Postcondition:
  `!`(bool)*this

Definition at line 634 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

std::tr1::function< _Res(...)>::function | ( | _M_clear_type * |  | ) | `[inline]`

Default construct creates an empty function call wrapper.

Postcondition:
  `!`(bool)*this

Definition at line 640 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

std::tr1::function< _Res(...)>::function | ( | const function< _Res(...)> & | __x | ) |

Function copy constructor.

Parameters:

  | x | A 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 828 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
template<typename _Functor>

std::tr1::function< _Res(...)>::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:

  | f | A 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 841 of file functional_iterate.h.

## Member Function Documentation

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

std::tr1::function< _Res(...)>::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 763 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

_Res std::tr1::function< _Res(...)>::operator() | ( | _GLIBCXX_PARAMS |  | ) | const

Invokes the function targeted by `*this`.

Returns:
  the result of the target.

Exceptions:

  | bad_function_call | when `!`(bool)*this

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

Definition at line 855 of file functional_iterate.h.

References _GLIBCXX_ARGS, and _GLIBCXX_COMMA.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
template<typename _Functor>

__gnu_cxx::__enable_if<!is_integral<_Functor>::value, function&>::__type std::tr1::function< _Res(...)>::operator= | ( | _Functor | __f | ) | `[inline]`

Function assignment to a new target.

Parameters:

  | f | A 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 725 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

function& std::tr1::function< _Res(...)>::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 697 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

function& std::tr1::function< _Res(...)>::operator= | ( | const function< _Res(...)> & | __x | ) | `[inline]`

Function assignment operator.

Parameters:

  | x | A 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 684 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

void std::tr1::function< _Res(...)>::swap | ( | function< _Res(...)> & | __x | ) | `[inline]`

Swap the targets of two function objects.

Parameters:

  | f | A function with identical call signature.

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

Definition at line 740 of file functional_iterate.h.

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
template<typename _Functor>

const _Functor * std::tr1::function< _Res(...)>::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 907 of file functional_iterate.h.

References std::tr1::_Any_data::_M_access().

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
template<typename _Functor>

_Functor * std::tr1::function< _Res(...)>::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 887 of file functional_iterate.h.

References std::tr1::_Any_data::_M_access().

template<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>

const type_info & std::tr1::function< _Res(...)>::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 870 of file functional_iterate.h.

References std::tr1::_Any_data::_M_access().

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

- functional_iterate.h