Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2006-10-19 05:09:02


Hi Guys,

On 10/19/06, Sohail Somani <s.somani_at_[hidden]> wrote:
> >
> > can it be used for multimethods ?
>
> Doesn't seem like it. It uses a single value to dispatch so it's the
> same thing as single dispatch. Shouldn't be impossible to dispatch based
> on multiple values though.
>

I have an example use (in the accompanying tests) which uses a
boost::tuple<> as the index type. If the aim was to use multiple
values, you can create a tuple from it and use that as an index --
then couple it with a validation and routing strategy that allows you
to validate and manipulate the index used for the dispatch.

If you need to call multiple methods, you can use the invoker
interface to the dispatcher -- but still using single dispatch. You
can even use Boost.Signals to register a set of methods and register
it to the dispatcher on a single index.

HTH

-- 
Dean Michael C. Berris
C++ Software Architect
Orange and Bronze Software Labs, Ltd. Co.
web: http://software.orangeandbronze.com/
email: dean_at_[hidden]
mobile: +63 928 7291459
phone: +63 2 8943415
other: +1 408 4049532
blogs: http://mikhailberis.blogspot.com http://3w-agility.blogspot.com
http://cplusplus-soup.blogspot.com

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