Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-12-06 15:07:53

Robert Kawulak wrote:

>> From: Robert Kawulak
>> 2008/12/5 Neal Becker <ndbecker2_at_[hidden]>:
>> > How about, floating point is allowed, but the results may
>> sometimes be surprising?
>> If the surprise consists of breaking the invariant, I'm not
>> convinced...
> Moreover, isn't your proposition actually similar to the current state?
> Technically, there are no limitations in the library to prevent you from
> defining bounded<float> ("floating point is allowed"). But the advice in
> the documentation ("don't use built-in floating point types with this
> library (until you really know what you're doing)") can be interpreted as
> "the results may sometimes be surprising".

Yes. I don't suggest changing anything. If you want to use float, you can, subject to the limitations we've already discussed. But, the limitations on floating point comparisons are/were always there, and those who care should already be aware of them.

All that happens, I think, is that when you assign a result to the constrained float type, it may or may not violate the constraint if it is very close to the limit. Sounds to me that it's still a useful construct.

Boost list run by bdawes at, gregod at, cpdaniel at, john at