[variant] Length of variant

View: New views
3 Messages — Rating Filter:   Alert me  

[variant] Length of variant

by Seweryn Habdank-Wojewodzki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

According to Karlsson boost::variant is limited to 11 elements.

Is there any option to extend that?
What are the real limitations for the VS 9.0 and GCC 4.0?
If number might be extended what might happen e.g. during compilation?
Is the size somewhere defined once or is spread in all the code of variant?

Best regards,
Seweryn Habdank-Wojewodzki.


_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [variant] Length of variant

by OvermindDL1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/7 Seweryn Habdank-Wojewódzki <seweryn@...>:
> Hi,
>
> According to Karlsson boost::variant is limited to 11 elements.
>
> Is there any option to extend that?
> What are the real limitations for the VS 9.0 and GCC 4.0?
> If number might be extended what might happen e.g. during compilation?
> Is the size somewhere defined once or is spread in all the code of variant?

As can be seen in variant_fwd.hpp, it seems the max size is defined by:

#define BOOST_VARIANT_LIMIT_TYPES \
    BOOST_MPL_LIMIT_LIST_SIZE

You might try defining BOOST_VARIANT_LIMIT_TYPES before including the
variant header and see if that works?

#define BOOST_VARIANT_LIMIT_TYPES 20
#include <boost/variant/variant.hpp>
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: [variant] Length of variant

by Igor R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can also put your types in mpl::vector or mpl::vectorNN and then
use make_variant_over metafunction.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users