|
Boost Users : |
Subject: Re: [Boost-users] [variant] 'which' out of range assertion
From: Daniel Bradburn (moagstar_at_[hidden])
Date: 2012-02-22 10:31:23
Hi Igor,
You can get around this by increasing the maximum size a variant can
handle, define the following symbols (or higher if you need):
#define BOOST_MPL_LIMIT_LIST_SIZE 30
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
And it should work again.
Regards
Dan
2012/2/22 Igor R <boost.lists_at_[hidden]>
> Hello,
>
>
> It appears that since 1.47 Boost.Variant has a bug that can be
> reproduced as follows (MSVC10, Debug mode):
>
> #include <boost/variant.hpp>
> #include <boost/mpl/vector/vector30.hpp>
>
> struct struct1{};
> struct struct2{};
> struct struct3{};
> struct struct4{};
> struct struct5{};
> struct struct6{};
> struct struct7{};
> struct struct8{};
> struct struct9{};
> struct struct10{};
> struct struct11{};
> struct struct12{};
> struct struct13{};
> struct struct14{};
> struct struct15{};
> struct struct16{};
> struct struct17{};
> struct struct18{};
> struct struct19{};
> struct struct20{};
> struct struct21{};
>
>
> typedef boost::mpl::vector21<
> struct1,
> struct2,
> struct3,
> struct4,
> struct5,
> struct6,
> struct7,
> struct8,
> struct9,
> struct10,
> struct11,
> struct12,
> struct13,
> struct14,
> struct15,
> struct16,
> struct17,
> struct18,
> struct19,
> struct20,
> struct21
> >::type vec_type;
> typedef boost::make_variant_over<vec_type>::type var_type;
>
>
> int main()
> {
> var_type v;
> v = struct21();
> }
>
> The last line generates assertion in variant_impl.hpp, line 264,
> visitation_impl() function: "Boost.Variant internal error: 'which' out
> of range."
>
> According to the release notes, variant wasn't changed in 1.47, but I
> recalled teh following discussion:
>
> http://boost.2283326.n4.nabble.com/large-variant-performance-compared-50-elements-tt3204484.html#a3205490
> It seems that the above issue is somehow related to this change.
>
>
> Igor'.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net