booster::function< Result(Params...)> Class Template Reference

This is Booster's implementation of std::tr1::function/booster::function. More...

`#include <booster/booster/function.h>`

## Public Types

typedef Result | result_type

## Public Member Functions

| function ()
template<typename F >
| function (F func)
| function (function const &other)
template<typename F >
function const & | operator= (F func)
function const & | operator= (function const &other)
result_type | operator() (Params...params) const
bool | empty () const
| operator bool () const
void | swap (function &other)

## Detailed Description

### template<typename Result, typename... Params>
class booster::function< Result(Params...)>

This is Booster's implementation of std::tr1::function/booster::function.

This function is created from generic object that can be "called" i.e. a class with operator() or function pointer that has same signature as the function.

See: http://www.boost.org/doc/html/function.html

Notes:

- this code is not taken from Boost and has slightly different interface.
- as most of compilers do not support Variadic templates yet, this class is explicitly specialized for Params of size 0 to 8. So maximal amout of parameters that can be used is 8.

## Member Typedef Documentation

template<typename Result , typename... Params>

typedef Result booster::function< Result(Params...)>::result_type

Type of result, for use with boost::bind

## Constructor & Destructor Documentation

template<typename Result , typename... Params>

booster::function< Result(Params...)>::function | ( |  | ) |

Default constructor, creates an empty functions

template<typename Result , typename... Params>
template<typename F >

booster::function< Result(Params...)>::function | ( | F | func | ) |

Creates a function from a functional func of type F. func should be copyable. It is copied and stored inside function object.

template<typename Result , typename... Params>

booster::function< Result(Params...)>::function | ( | function< Result(Params...)> const & | other | ) |

Copy function, Copies underlying functional object.

## Member Function Documentation

template<typename Result , typename... Params>

bool booster::function< Result(Params...)>::empty | ( |  | ) | const

Return true if the function is empty

template<typename Result , typename... Params>

booster::function< Result(Params...)>::operator bool | ( |  | ) | const

Returns true if the function is not empty

template<typename Result , typename... Params>

result_type booster::function< Result(Params...)>::operator() | ( | Params... | params | ) | const

Calls underling functional object. If the function is empty, throws bad_function_call.

template<typename Result , typename... Params>
template<typename F >

function const& booster::function< Result(Params...)>::operator= | ( | F | func | ) |

Assign a functional func of type F. func should be copyable. It is copied and stored inside function object.

template<typename Result , typename... Params>

function const& booster::function< Result(Params...)>::operator= | ( | function< Result(Params...)> const & | other | ) |

Assignment operator. Copies underlying functional object.

template<typename Result , typename... Params>

void booster::function< Result(Params...)>::swap | ( | function< Result(Params...)> & | other | ) |

Swaps two functional object. Does not throw.

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

- booster/function.h