Subject: Re: [boost] [review][constrained_value] Review ofConstrainedValueLibrary begins today
From: Stjepan Rajko (stjepan.rajko_at_[hidden])
Date: 2008-12-06 11:33:24


On Sat, Dec 6, 2008 at 9:32 AM, Jeff Flinn
<TriumphSprint2000_at_[hidden]> wrote:
> 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.
>

It was John Maddock:
http://tinyurl.com/6mnzxz

He also suggests that the strategy he proposes would perhaps get EBO
on more compilers.

Stjepan