stop_source
's operator!=
Section: 32.3.5 [stopsource] Status: C++20 Submitter: Tim Song Opened: 2020-01-03 Last modified: 2021-02-25
Priority: 0
View all issues with C++20 status.
Discussion:
Just like stop_token
(see LWG 3254), stop_source
in 32.3.5 [stopsource]
declares an operator!=
friend that is unnecessary in light of the new core language rules and
should be struck.
[2020-01-14 Status set to Tentatively Ready after six positive votes on the reflector.]
Proposed resolution:
This wording is relative to N4842.
Modify 32.3.5 [stopsource], class stop_source
synopsis, as indicated:
namespace std { […] class stop_source { public: […] [[nodiscard]] friend bool operator==(const stop_source& lhs, const stop_source& rhs) noexcept;[[nodiscard]] friend bool operator!=(const stop_source& lhs, const stop_source& rhs) noexcept;friend void swap(stop_source& lhs, stop_source& rhs) noexcept; }; }
Modify [stopsource.cmp] and [stopsource.special] as indicated:
32.3.4.3 Non-member functions
Comparisons[stopsource.nonmemberscmp][[nodiscard]] bool operator==(const stop_source& lhs, const stop_source& rhs) noexcept;-1- Returns:
true
iflhs
andrhs
have ownership of the same stop state or if bothlhs
andrhs
do not have ownership of a stop state; otherwisefalse
.[[nodiscard]] bool operator!=(const stop_source& lhs, const stop_source& rhs) noexcept;
-2- Returns:!(lhs==rhs)
.
32.3.4.4 Specialized algorithms [stopsource.special]friend void swap(stop_source& x, stop_source& y) noexcept;-1- Effects: Equivalent to:
x.swap(y)
.