From: Allen Bierbaum (allenb_at_[hidden])
Date: 2003-04-04 17:10:27
Eric Friedman wrote:
> Allen Bierbaum wrote:
>>I have been very impressed with the Variant library and started using it
>>with Boost 1.29.
> Good to hear. I'd be interested in your experience using the library in a
> real-world (?) application.
I was able to get variant working with 1.30 by pulling some of the code
out of the sandbox.
I have started using it in my application and have run into one major
limitation: variant size (in number of allowed types)
I need to use a variant of about 15-20 allowed types. By default
variant only works with 10 types. I know that by defining:
BOOST_MPL_LIMIT_LIST_SIZE=20 and BOOST_MPL_NO_PREPROCESSED_HEADERS
I can get the limit up to 20 or 30 or whatever I want. Unfortunately
this also ups the limits on *all* lists that may be in the code and
makes compile times take much longer since I can't use the preprocessed
Anyway, looking back through the list I found a reference here:
that says the recommended way to do this type of thing when users want
longer list types is to use the numbered list types. I know this
doesn't directly relate to variant, but I was thinking it would be very
nice to have something similar for variant.
So for example I could say:
to get a variant that allows 27 types.
I would also be happy with something like:
boost::variant<27, type1, type2,..., type27>
but I could see where some people would not like this form since it
requires the size to be explicitly set.
Maybe something like this would work better.
boost::variantS<27, type1, ..., type27>
This provides an explicit type that is used when you want the first
parameter to be the size, but still allows the normal boost::variant
type to automatically detect the size.
What do you think, are either of these two options feasible (or is there
already support for it that I missed)?
>>I now need to start to using Boost 1.30.0 though and I don't think the
>>variant library distributed for the review will work with the 1.30.0
>>Does anyone have any suggestions how I can use the variant library with
>>Boost 1.30.0? Anyone have an updated distribution of the Variant library?
> I plan to ready the code for release with 1.31. Until then, you can try
> using the code in the sandbox, which I have recently updated to work with
> Note, however, that the code in the sandbox will change -- sometimes
> significantly -- and integrates variant with other libraries I am
> developing, such as Boost.Visitor and Boost.Move. If this is a problem for
> you, you may want to update the variant submission code yourself. Most of
> the required changes are to accomodate class and header name-changes in MPL
> between 1.29 and 1.30 -- nothing terribly significant.
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- -- Allen Bierbaum allenb_at_[hidden] -- -- VR Juggler Team www.vrjuggler.org -- -- Virtual Reality Applications Center www.vrac.iastate.edu --
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk