The (in)equality comparison with boost::none does not require that T be EqualityComparable

This commit is contained in:
Andrzej Krzemienski
2014-04-29 22:59:06 +02:00
parent d59f47156f
commit c51f3e810b
9 changed files with 148 additions and 16 deletions

View File

@ -106,6 +106,10 @@
template<class T> inline bool operator <= ( optional<T> const& x, optional<T> const& y ) ; ``[link reference_operator_compare_less_or_equal_optional_optional __GO_TO__]``
template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ; ``[link reference_operator_compare_greater_or_equal_optional_optional __GO_TO__]``
template<class T> inline bool operator == ( optional<T> const& x, none_t ) noexcept ; ``[link reference_operator_compare_equal_optional_none __GO_TO__]``
template<class T> inline bool operator != ( optional<T> const& x, none_t ) noexcept ; ``[link reference_operator_compare_not_equal_optional_none __GO_TO__]``
// [new in 1.34]
template<class T> inline optional<T> make_optional ( T const& v ) ; ``[link reference_make_optional_value __GO_TO__]``
@ -972,6 +976,7 @@ __SPACE__
[: `bool operator == ( optional<T> const& x, optional<T> const& y );`]
* [*Requires:] `T` shall meet requirements of `EqualityComparable`.
* [*Returns:] If both `x` and `y` are initialized, `(*x == *y)`. If only
`x` or `y` is initialized, `false`. If both are uninitialized, `true`.
* [*Throws:] Nothing.
@ -1011,6 +1016,7 @@ __SPACE__
[: `bool operator < ( optional<T> const& x, optional<T> const& y );`]
* [*Requires:] `T` shall meet requirements of `LessThanComparable`.
* [*Returns:] If `y` is not initialized, `false`. If `y` is initialized
and `x` is not initialized, `true`. If both `x` and `y` are initialized,
`(*x < *y)`.
@ -1065,7 +1071,7 @@ __SPACE__
[: `bool operator <= ( optional<T> const& x, optional<T> const& y );`]
* [*Returns: ] `!( y<x );`
* [*Returns: ] `!( y < x );`
* [*Throws:] Nothing.
__SPACE__
@ -1077,6 +1083,23 @@ __SPACE__
* [*Returns: ] `!( x<y );`
* [*Throws:] Nothing.
[#reference_operator_compare_equal_optional_none]
[: `bool operator == ( optional<T> const& x, none_t ) noexcept;`]
* [*Returns:] `!x`.
* [*Notes:] `T` need not meet requirements of `EqualityComparable`.
__SPACE__
[#reference_operator_compare_not_equal_optional_none]
[: `bool operator != ( optional<T> const& x, none_t ) noexcept;`]
* [*Returns: ] `!( x == y );`
__SPACE__
[#reference_swap_optional_optional]