Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-01-22 21:19:52


On Monday 22 January 2001 08:27, you wrote:
> Could someone provide a brief summary of the purpose of any_function?

It is essentially a generalized function pointer. It can store any
function object which can be invoked using any_function's function call
operator (hence it is a function pointer generalized to handle any function
object).

Here's a quick example of its usage:
any_function<long, int, int> f1; // f1 takes two integers and returns a long
f1 = std::plus<int>();
std::cout << "3 + 5 = " << f1(3, 5) << std::endl;

There was much discussion in November and December 2000 about "callbacks" -
any_function is the same thing but with a (possibly) less objectionable name.

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk