Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::future<T>::future

      From cppreference.com
      <cpp‎ |experimental‎ |future

      [edit template]
       
       
       
       
       
      future()noexcept;
      (1)
      future(std::experimental::future<T>&& f)noexcept;
      (2)
      future(conststd::experimental::future<T>&)= delete;
      (3)
      (4)
      1) Default constructor. Constructs an emptyfuture object that does not refer to a shared state.
      2) Constructs afuture object, transferring the shared state held byf, if any. After construction,f.valid() isfalse.
      3) Copy constructor is deleted.future cannot be copied.
      4) Unwrapping constructor. Constructs afuture object from the shared state referred to byother, if any. Ifother.valid()==false prior to this call, the constructedfuture object is empty. Otherwise, the resultingfuture object becomes ready when one of the following happens:
      • other andother.get() are both ready. The value or exception fromother.get() is stored in the shared state associated with the resultingfuture object.
      • other is ready, butother.get() is invalid. An exception of typestd::future_error with an error condition ofstd::future_errc::broken_promise is stored in the shared state associated with the resultingfuture object.
      After this constructor returns,valid() is equal to the value ofother.valid() prior to this call, andother.valid()==false.


      Contents

      [edit]Parameters

      f - another future object to initialize with
      other - astd::experimental::future object to unwrap

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 2697Concurrency TSbehavior of unwrapping constructor is unclear with an invalidfutureconstructs an emptyfuture

      [edit]See also

      constructs the future object
      (public member function ofstd::future<T>)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/future/future&oldid=98645"

      [8]ページ先頭

      ©2009-2026 Movatter.jp