Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-10-19 12:45:33


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Dean
> Michael Berris
> Sent: Thursday, October 19, 2006 2:09 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Runtime Dynamic Dispatch (boost-dispatch)
>
> 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.

Cool! Can it do Common Lisp-like dispatch where it calls one function if
0 <= x < 5 and another if 5 <= x < 10?


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