Boost logo

Boost :

Subject: Re: [boost] [Variant] C++11 variadic template implementation
From: sfields (stuartfields3_at_[hidden])
Date: 2012-09-11 03:05:25

Mathias Gaunard-2 wrote
> On 15/04/12 11:57, Florian Goujeon wrote:
>> Hi Boosters,
>> I'd like to know if anybody were working on a C++11 version (using
>> variadic
>> templates) of Boost.Variant.
> Variadic templates would not help at all with Boost.Variant.
>> I've written an implementation.
> Did you find a magic way to make a switch statement from a template
> parameter pack?

Why not just use template partial specialization to explicitly expand the
first N template arguments into a switch statement and recursively expand
the remaining arguments in the default case if that fails? Something along
the lines of recursive_apply <Args...>::apply(index) with the default case
calling recursive_apply <Tail...>::apply(index-N) should there
some subtly I'm missing here?

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at