Boost logo

Boost :

From: Marco Costalba (mcostalba_at_[hidden])
Date: 2007-10-12 02:42:31


Now that we have an overload implementation I was starting to think
how to integrate Dean dispatcher with overload.

Integration from ABOVE:

a dispatcher holds a fusion::vector of overloads objects instead of
directly boost::functions, so that you can say

d[0](7);
d[0](7, "test");

This is the most natural and most immediate approach.

But a perhaps more interesting approach is

Integration from BELOW:

In this case is overload that holds, instead of a tuple of
boost:function objects a tuple of dispatcher opbjects.

Currently dispatcher is single-signature, and this fits perfectly as a
replacement for boost::function as used in overload.

In this case we could have

int foo1();
int foo2();
int bar();

overload<int(), int(int)> f;

f.set(foo1);
f.set(foo2);
f.set(bar);

f()[0]; //calls foo1
f()[1]; //calls foo2
f(7); //calls bar

Just some rough ideas to get some comments...

Thanks
Marco


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