Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-11-03 17:53:57

Persson Jonas wrote:
>>-----Original Message-----
>>From: Eric Friedman [mailto:ebf_at_[hidden]]
>>Sent: den 31 oktober 2003 22:31
>>To: boost_at_[hidden]
>>Subject: [boost] Re: Variant size bug?
> ...
>>Well, technically it's not a bug: variant<> *is*
>>I agree this may be unexpected, and so should probably be noted more
>>explicitly in the docs.
>>Also, we _can_ argue whether this unexpectedness constitutes a bug in
>>variant's design. (It's certainly not an *implementation* bug though.)
> And to add even more unexpectedness:
> typedef boost::variant<> Var0;
> int s0 = boost::mpl::size<Var0::types>::type::value;
> gives s0=1, but
> typedef boost::mpl::vector<> V0;
> typedef boost::variant<V0> Var0;
> int s0 = boost::mpl::size<Var0::types>::type::value;
> gives s0=0 !
> So apparently mpl compatibility depends on if the user declares
> the variant with a typelist or gives it the types directly.

Yes, I realized this (implementation) bug after your initial report.
However, I believe the behavior you describe should now be fixed (i.e.,
the second case should also give s0==1).

Have you recently updated from CVS?

Of course, this does not answer the *design* question. I will comment
further on this in reply to your other message in this thread.


Boost list run by bdawes at, gregod at, cpdaniel at, john at