Boost logo

Boost :

Subject: Re: [boost] Any interest in dynamic dispatching mechanism from "interface" to template functions ?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-07-01 08:41:42


On 01/07/10 11:32, Raffi Enficiaud wrote:

> An example of use could be (general idea, not a real code of course):
> // --------------
>
> template <class real_type>
> int template_function(real_type const& r_class1, double param_d, int&
> param_out)
> {
> // ...
> return 0;
> }
>
> int interface_function(MyInterface const* i_class1, variant const&
> param, variant& out)
> {
> // return value
> int return_value;
>
> // constructs the dispatcher object with a reference to the values
> passed to interface_function
> dispatcher<int, MyInterface const*, variant const&, variant&>
> dispatch_object(return_value, i_class1, param, out);
>
> bool res = dispatch_object.calls_first(
> fusion::vector_tie(
> template_function < class_t1 >,
> template_function < class_t2 > //...
> )
> );
> if(res) return return_value;
> return -1;
> }

Isn't that what apply_visitor already does, albeit it only deals with
variant and not base classes?


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