• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    <stop_token>

    std::stop_callback::推論補助

    namespace std {
      template <class Callback>
      stop_callback(stop_token, Callback) -> stop_callback<Callback>;
    }
    

    概要

    stop_callbackクラステンプレートの型推論補助。

    #include <stop_token>
    #include <type_traits>
    
    struct X {
      void operator()() {}
    };
    
    int main()
    {
      X x;
      std::stop_token st;
      std::stop_callback cb { st, x };
    
      static_assert(std::is_same_v<decltype(cb)::callback_type, X>);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系

    関連項目