Boost logo

Boost :

Subject: Re: [boost] [variant] Warning: variadic templates in boost::variant
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-12-10 16:54:13


On 12/10/13 15:35, Larry Evans wrote:
[snip]
>
> Hi Matt,
>
> I'm trying to understand how you arrive at the static_visitor. Since
> the set of bounded types in the variant is a result of
> metaprogramming, I'm guessing that the static_visitor would also have
> to be the result of some metaprogramming. Otherwise I can't figure
> out how it could be done. I'm guessing that you use some sort of
> inheritance for each bounded type.
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Should be:

   inheritance for the operator() member function
   for each bounded type.

IOW.

template<typname Head, typename... Tail>
class my_visitor
: public my_visitor<Tail...>
{
public:
     int operator()(Head&) const
     ;
};

template<>
class my_visitor
: public static_visitor<int>
{
};

> Is that right?
>
> -regards,
> Larry
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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