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
>> 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 suffice...is there
some subtly I'm missing here?
-- View this message in context: http://boost.2283326.n4.nabble.com/Variant-C-11-variadic-template-implementation-tp4558834p4635582.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk