Boost logo

Boost :

Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Peter Dimov (lists_at_[hidden])
Date: 2013-01-08 14:03:09

Nevin Liber wrote:
> On 8 January 2013 12:09, Peter Dimov <lists_at_[hidden]> wrote:
> > Yes, I agree. To expand on that, the requirements defined by the
> > standard
> > library such as CopyConstructible, LessThanComparable, and so on, do not
> > have preconditions. So if a movable type claims to conform to these
> > requirements, it can't impose a precondition that the operations only
> > work
> > on values that haven't been moved from.
> I believe it can. Take n3485 25.4p3 (Sorted and related operations):
> "For algorithms other than those described in 25.4.3 to work correctly,
> comp has to induce a strict weak ordering on the values."
> This, for instance, allows sorting of doubles as long as none of them are
> NaN.

If I have the values { 1, 7, 5, -3 } and a predicate that works correctly
for these specific values, but returns garbage for others, does it satisfy
the requirement? An interesting question... for another time, maybe.

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