Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] Review ofConstrainedValueLibrary begins today
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-12-06 11:32:11


Robert Kawulak wrote:
>> From: vicente.botet

...

> We already have a single type that covers both static and dynamic constraints,
> so what is the point? Did I misunderstood something?
>
>> I expect that a constrained integer will have the same size
>> as an int, i.e. sizeof(int). Which is the size of an instance
>> of the constrained class?
>
> Here are some examples:
>
> GCC 4.3.2:
>
> 4 = sizeof (int)
> 4 = sizeof (bounded_int<int, 0, 128>::type)
> 12 = sizeof (bounded<int, int, int>::type)
> 4 = sizeof (constrained<int, is_even>)
>
> MSVC 8.0 SP1:
>
> 4 = sizeof (int)
> 8 = sizeof (bounded_int<int, 0, 128>::type)
> 20 = sizeof (bounded<int, int, int>::type)
> 8 = sizeof (constrained<int, is_even>)
>
> I don't know why MSVC cannot opimise the size as well as GCC, but anyway the
> library allows for perfect size optimisation with some compilers.

Another reviewer mentioned he saw a problem in the implementations use
of EBO. I can't find that posting, but I thought it was Paul Bristow or
John Maddock. Perhaps that explains the MSVC size issue.

Jeff


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