Boost logo

Boost :

Subject: Re: [boost] [constrained_value] default initialization
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2008-12-07 12:56:25


Hi Jeff,
 
> I couldn't find mention of what is the initial value of
>
> bounded_int<int, 123, 456>::type some_var;
>
> I assume it follows the rules for an int?

Default construction always causes the underlying value to be value-initialised,
so it'll be 0. Since 0 is not within the allowed range, the error policy will be
invoked throwing an exception.

> The Simple constrained objects examples says the following is legal:
>
> even_int a;
>
> What about:
>
> odd_int b;

Same as above -- the underlying value will be 0 and the error policy will be
invoked.

Best regards,
Robert


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