• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <stop_token>

    std::stop_source::stop_possible

    [[nodiscard]]
    bool stop_possible() const noexcept; // (1) C++20
    bool stop_possible() const noexcept; // (1) C++26
    

    概要

    停止要求を作成できるかどうかを返す。

    戻り値

    自身が停止状態を所有しているときはtrueを返す。それ以外の場合はfalseを返す。

    例外

    投げない。

    #include <cassert>
    #include <stop_token>
    
    int main()
    {
      std::stop_source ss1;
      std::stop_source ss2(std::nostopstate);
    
      assert(ss1.stop_possible() == true);
      assert(ss2.stop_possible() == false);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系

    参照