Boost logo

Boost :

Subject: Re: [boost] interest in generic cyclic visitor?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-08-03 10:24:02


On 08/03/12 07:58, Sohail Somani wrote:
> On 03/08/2012 3:17 AM, Jan Herrmann wrote:
>> Additionally it can be used as a base for multimethod implementation.
>
> This is much more interesting to me. Can you elaborate or give some
> sample code?
>
>
Then you might be interested in the multimethods discussion
in a July 2010 thread:

  http://thread.gmane.org/gmane.comp.lib.boost.devel/206203

As shown elsewhere in that thread, there's multimethod code available
already in the boost sandbox. That code:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/composite_storage/sandbox/pack/predator_prey.cpp

is one example. Another, more complete example, is here:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/composite_storage/sandbox/pack/one_of_multiple_dispatch.test.cpp

The more complete example shows the method can be used both with virtual
functions and discriminated unions, such as boost:: variant
or that in:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/composite_storage/pack/container_one_of_maybe.hpp

Unfortunately, the multimethod using the one_of_maybe discriminated
union can be a compile-time hog (based on some simple tests I've run).
I've no idea why :(

HTH.

-Larry


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