Boost logo

Boost :

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


On 9/2/07, Dean Michael Berris <mikhailberis_at_[hidden]> wrote:
> Hi Tobias!
>
> On 9/2/07, Tobias Schwinger <tschwinger_at_[hidden]> wrote:
> >
>
> Though it is interesting -- I've been playing around with the idea of
> an overloaded type-safe dispatcher for some time, but I never got to
> thinking of a way to accomplish it in a clean manner. Basically
> something that will allow the following:
>

A possible way, as implemented in my example, is to use a multi-valued
map (std::multimap) to store keys so that for each key value you get a
set of objects.

The second step is to store corresponding signature in the object "as
the object type" so that you can check for correct signature with a
dynamic_cast<> of stored objects against the dispatch request.

Anyhow "simple_factory.hpp" code is much clear then the above explanation... ;-)

Marco


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