|
Boost : |
From: Persson Jonas (jonas.persson_at_[hidden])
Date: 2003-11-03 12:12:01
> -----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*
> variant<boost::empty>.
>
> 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.
/ Jonas
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk