I guess I don't quite understand the point of this...
This argument holds equally for ostream << i -- we've arbitrarily assigned a certain meaning to a binary operation that otherwise has no mathematical intuition. Is this wrong? What is the advantage is gained by disallowing it?
He mentions the problem presented by optional<T> but the original case study for this is IEEE-754 NaNs -- NaNs fail all comparisons (including NaN==NaN). See explanation here: http://stackoverflow.com/a/1573715/583604 So his argument for a mathematical basis is already on shaky ground.
I think the point is simply that in order to store an object in an ordered container, by default one is forced to define operator <, which for some types doesn't make sense and could lead to mistakes when writing mathematical code. The presented solution, which disconnects the concept of 'less' from 'order' is, I think, quite elegant.
12
u/mcmcc #pragma once Aug 08 '14
I guess I don't quite understand the point of this...
This argument holds equally for
ostream << i-- we've arbitrarily assigned a certain meaning to a binary operation that otherwise has no mathematical intuition. Is this wrong? What is the advantage is gained by disallowing it?He mentions the problem presented by
optional<T>but the original case study for this is IEEE-754 NaNs -- NaNs fail all comparisons (including NaN==NaN). See explanation here: http://stackoverflow.com/a/1573715/583604 So his argument for a mathematical basis is already on shaky ground.