Namespaces
Variants

std::packaged_task<R(Args...)>:: get_future

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:: future < R > get_future ( ) ;
(C++11부터)

future * this 와 동일한 공유 상태를 공유하는 future 를 반환합니다.

get_future 는 각 packaged_task 에 대해 한 번만 호출할 수 있습니다.

매개변수

(없음)

반환값

* this 와 동일한 공유 상태를 가지는 future입니다.

예외

std::future_error 가 다음 오류 조건에서 발생합니다:

  • 공유 상태가 이미 get_future 호출을 통해 검색되었습니다. 오류 범주는 future_already_retrieved 로 설정됩니다.
  • * this 에는 공유 상태가 없습니다. 오류 범주는 no_state 로 설정됩니다.