This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3362. Strike stop_source's operator!=

Section: 32.3.4 [stopsource] Status: WP Submitter: Tim Song Opened: 2020-01-03 Last modified: 2020-02-24

Priority: 0

View all issues with WP status.

Discussion:

Just like stop_token (see LWG 3254), stop_source in 32.3.4 [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.

  1. Modify 32.3.4 [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;
      };
    }
    
  2. Modify [stopsource.cmp] and [stopsource.special] as indicated:

    32.3.4.3 Non-member functionsComparisons [stopsource.nonmemberscmp]

    [[nodiscard]] bool operator==(const stop_source& lhs, const stop_source& rhs) noexcept;
    

    -1- Returns: true if lhs and rhs have ownership of the same stop state or if both lhs and rhs do not have ownership of a stop state; otherwise false.

    [[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).