|
Boost : |
Subject: Re: [boost] [Variant] C++11 variadic template implementation
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-04-18 11:52:32
On 04/15/12 12:39, Larry Evans wrote:
> On 04/15/12 04: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.
>>
>> I currently use the 'classic' version in my project, but since I need
>>
>> more-than-20-type variants, the compilation take a lot of time
>> (extending the
>>
>> number of types that variant can support forces you to disable the use of
>>
>> precompiled headers). Plus, I'll need to use 70 type variants (MPL lists
>> are
>>
>> physically limited to 50 types).
[snip]
> There's this:
>
>
> http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/composite_storage/pack/container_one_of_maybe.hpp
>
> which uses variadic templates; hence, doesn't have the limitations you
> mentioned about the number of bounded types.
[snip]
OOPS. I failed to remember that container_one_of_maybe does use the
proposed switch library, which includes:
http://svn.boost.org/svn/boost/sandbox/switch/boost/control/switch.hpp
which does have these code lines:
#ifndef BOOST_SWITCH_LIMIT
#define BOOST_SWITCH_LIMIT 50
#endif
#if BOOST_SWITCH_LIMIT > BOOST_PP_LIMIT_REPEAT
#error BOOST_SWITCH_LIMIT exceeds Boost.Preprocessor limit
#endif
#if BOOST_SWITCH_LIMIT > BOOST_PP_LIMIT_ITERATION
#error BOOST_SWITCH_LIMIT exceeds Boost.Preprocessor limit
#endif
which means container_one_of_maybe *does* have the limitations you were
trying to avoid.
Sorry for noise.
I believe container_one_of_maybe could be modified to use the
"static array of function pointers" method mentioned in another post
to this thread, which was written by Paul Fultz:
http://article.gmane.org/gmane.comp.lib.boost.devel/230073
The only reason that method was not tried in container_one_of_maybe
was for reasons cited in my reply to Paul's post.
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk