• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <stop_token>

    std::operator==

    namespace std {
      [[nodiscard]]
      friend bool
        operator==(const stop_source& x,
                   const stop_source& y) noexcept; // (1) C++20
      friend bool
        operator==(const stop_source& x,
                   const stop_source& y) noexcept; // (1) C++26
    }
    

    概要

    stop_sourceオブジェクトの等値比較を行う。

    戻り値

    xyが同じ停止状態を共有している場合、あるいはどちらも停止状態を所有していない場合はtrueが返る。それ以外の場合はfalseが返る。

    例外

    投げない。

    #include <cassert>
    #include <stop_token>
    
    int main()
    {
      std::stop_source ss1;
      std::stop_source ss2 = ss1;
      std::stop_source ss3;
      std::stop_source ss4(std::nostopstate);
      std::stop_source ss5(std::nostopstate);
    
      assert(ss1 == ss2);
      assert(ss1 != ss3);
      assert(ss1 != ss4);
      assert(ss4 == ss5);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系

    参照