Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::promise<R>::promise

      From cppreference.com
      <cpp‎ |thread‎ |promise
       
       
      Concurrency support library
      Threads
      (C++11)
      (C++20)
      this_thread namespace
      (C++11)
      (C++11)
      (C++11)
      Cooperative cancellation
      Mutual exclusion
      Generic lock management
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      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
       
       
      promise();
      (1)(since C++11)
      template<class Alloc>
      promise(std::allocator_arg_t,const Alloc& alloc);
      (2)(since C++11)
      promise( promise&& other)noexcept;
      (3)(since C++11)
      promise(const promise& other)= delete;
      (4)(since C++11)

      Constructs apromise object.

      1) Default constructor. Constructs the promise with an empty shared state.
      2) Constructs the promise with an empty shared state. The shared state is allocated usingalloc.Alloc must meet the requirements ofAllocator.
      3) Move constructor. Constructs the promise with the shared state ofother using move semantics. After construction,other has no shared state.
      4)promise is not copyable.

      [edit]Parameters

      alloc - allocator to use to allocate the shared state
      other - anotherpromise to acquire the state from

      [edit]Exceptions

      1,2) May throw implementation-defined exceptions.

      [edit]Example

      This section is incomplete
      Reason: no example
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/thread/promise/promise&oldid=161206"

      [8]ページ先頭

      ©2009-2025 Movatter.jp