Boost logo

Boost :

From: Marco Costalba (mcostalba_at_[hidden])
Date: 2007-09-07 02:17:24


On 9/6/07, Dean Michael Berris <mikhailberis_at_[hidden]> wrote:
>
>
> In this case, I think the approach I will take will be a bit more
> different that what you have chosen to do. Since I plan to do
> something like:
>
> void foo(int a) { ... };
> void bar(int a, int b) { ... };
> void foobar(int a, double b) { ... };
>
> dispatcher< fusion::vector<void(int), void(int,int), void(int, double)> > d;

That's another design decision is not suitable for an object factory.

When you instantiate the dispatcher you already know _all_ the
signatures that the dispacther will provide.

But for a factory this is not true. You can register/add new
signatures at runtime anywhere in the program.

It would be if you dispacther is able to support something like this:

dispatcher< fusion::vector<void(int), void(int,int), void(int, double)> > d;

double another_foo(char*) { ... };

d += fusion::vector<double(char*)>;

d[0] = &another_foo;

d[0]("test"); // another_foo() is called

Marco


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