Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2019-05-22 23:18:43


On 23/05/2019 00:30, Erik Thiele wrote:
> if the time_duration datatype is a complete partial order which is for
> example needed for it to be able to be sorted, then the above output is
> partly illegal:
>
> if not a<b and not b<a then must be a=b. but this is not the case.
>
> if a<=b and b<=a then must be a=b. but this is not the case.

not_a_date_time is like a NaN. NaNs are weird like that.

Returning true for the <= and >= operations is probably actually a bug;
it's a side effect of using less_than_comparable when it should be using
partially_ordered instead. You should raise an issue about that on
GitHub or submit a PR to fix it.

> so as expected the two vectors v0 and v1 are not equal after being
> sorted even though they certainly should be!

A default constructed time_duration is equal to zero duration. A
not_a_date_time time_duration is not a zero duration. Why would you
expect them to be equal?

> i do not understand why time_duration is behaving in such a strange way
> here.
>
> I am using time_duration(not_a_date_time) as a SQL-NULL value just like
> i am using date(not_a_date_time) and ptime(not_a_date_time) as SQL-NULL
> values.

SQL NULLs are weird, just like NaNs, so this should not be surprising to
you.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net