Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Polymorphic function wrappers.

#include <boost/tr1/functional.hpp>

or

#include <functional>

The polymorphic function wrappers are a family of class templates that may be used as a generalized callback mechanism. A polymorphic function wrapper shares features with function pointers, in that both define a call interface (for example a function taking two integer arguments and returning a floating-point value) through which some arbitrary code may be called. However a polymorphic function wrapper can call any callable object with a compatible call signature, this could be a function pointer, or it could be a function object produced by std::tr1::bind, or some other mechanism. For more information see the Boost.Function documentation.

namespace std {
namespace tr1 {

// [3.7] polymorphic function wrappers
class bad_function_call;

template<class Function>
class function;

template<class Function>
void swap(function<Function>&, function<Function>&);

template<class Function1, class Function2>
void operator==(const function<Function1>&, const function<Function2>&);
template<class Function1, class Function2>
void operator!=(const function<Function1>&, const function<Function2>&);
template <class Function>
bool operator==(const function<Function>&, unspecified-null-pointer-type );
template <class Function>
bool operator==(unspecified-null-pointer-type , const function<Function>&);
template <class Function>
bool operator!=(const function<Function>&, unspecified-null-pointer-type );
template <class Function>
bool operator!=(unspecified-null-pointer-type , const function<Function>&);

} // namespace tr1
} // namespace std

Configuration: Boost.Config should (automatically) define the macro BOOST_HAS_TR1_FUNCTION if your standard library implements this part of TR1.

Standard Conformity: The Boost version of std::tr1::function lacks the member function target_type() and does not inherit from std::unary_function or std::binary_function when applicable. The member function target() can only access pointer-to-member targets when they have been wrapped in mem_fn.


PrevUpHomeNext