Namespaces
Variants

std::future<T>:: share

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
std:: shared_future < T > share ( ) noexcept ;
このHTMLコードはC++の関数宣言を表示するもので、翻訳対象となる自然言語のテキストは含まれていません。すべてがHTMLタグ、属性、およびC++コード(`std::shared_future share() noexcept;`)で構成されているため、翻訳は不要です。

* this の共有状態(もしあれば)を std::shared_future オブジェクトに転送します。複数の std::shared_future オブジェクトが同じ共有状態を参照することが可能であり、これは std::future では実現不可能な機能です。

share std::future に対して呼び出した後、 valid ( ) == false となります。

目次

パラメータ

(なし)

戻り値

std::shared_future オブジェクトで、以前に * this が保持していた共有状態(もしあれば)を含むもの。 これは std:: shared_future < T > ( std :: move ( * this ) ) によって構築されたかのように生成される。

不具合報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 2556 C++11 share() valid() true であることを要求 要件が削除され、 noexcept

関連項目

非同期に設定される値(他のfuturesによって参照される可能性がある)を待機する
(クラステンプレート)