Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-10-30 20:02:23


Brian McNamara <lorgon_at_[hidden]> writes:

> On Thu, Oct 30, 2003 at 02:18:11PM -1000, David Abrahams wrote:
>> Persson Jonas <jonas.persson_at_[hidden]> writes:
>> > int main() {
>> > typedef boost::variant<> Var0;
>> > int s0 = boost::mpl::size<Var0::types>::type::value;
> ...
>> > }
>> >
>> >>From this I expected the output:
>> > 0,1,2,3
>> >
>> > but I got:
>> > 1,1,2,3
>>
>> Well that's about as good as anyone could want, since there are no
>> zero-sized types.
>
> Looking closely, I don't think this is the issue.
> The number he is printing is the compile-time-constant
> length-of-list-of-types, and not the sizeof() any object, right?

Oh, right.

> You can have a zero-length MPL sequence, yes?

Yep.

's a bug.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk