Standard library header <future> (C++11)
From cppreference.net
Dieser Header ist Teil der Thread-Unterstützungsbibliothek .
Klassen |
||
|
(C++11)
|
speichert einen Wert für asynchrone Abfrage
(Klassentemplate) |
|
|
(C++11)
|
kapselt eine Funktion, um ihren Rückgabewert für asynchrone Abfrage zu speichern
(Klassentemplate) |
|
|
(C++11)
|
wartet auf einen asynchron gesetzten Wert
(Klassentemplate) |
|
|
(C++11)
|
wartet auf einen Wert (möglicherweise referenziert durch andere Futures), der asynchron gesetzt wird
(Klassentemplate) |
|
|
(C++11)
|
gibt die Startrichtlinie für
std::async
an
(enum) |
|
|
(C++11)
|
spezifiziert die Ergebnisse von zeitgesteuerten Wartevorgängen auf
std::future
und
std::shared_future
(enum) |
|
|
(C++11)
|
meldet einen Fehler im Zusammenhang mit Futures oder Promises
(Klasse) |
|
|
(C++11)
|
identifiziert die Future-Fehlercodes
(enum) |
|
|
spezialisiert das
std::uses_allocator
Type-Trait
(Klassen-Template-Spezialisierung) |
||
|
(C++11)
(bis C++17)
|
spezialisiert das
std::uses_allocator
Typ-Trait
(Klassen-Template-Spezialisierung) |
|
Funktionen |
||
|
(C++11)
|
führt eine Funktion asynchron aus (möglicherweise in einem neuen Thread) und gibt eine
std::future
zurück, die das Ergebnis halten wird
(Funktions-Template) |
|
|
(C++11)
|
identifiziert die Future-Fehlerkategorie
(Funktion) |
|
|
(C++11)
|
spezialisiert den
std::swap
Algorithmus
(Funktionsschablone) |
|
|
(C++11)
|
spezialisiert den
std::swap
Algorithmus
(Funktions-Template) |
|
Übersicht
namespace std { enum class future_errc { broken_promise = /* implementierungsdefiniert */, future_already_retrieved = /* implementierungsdefiniert */, promise_already_satisfied = /* implementierungsdefiniert */, no_state = /* implementierungsdefiniert */ }; enum class launch : /* nicht spezifiziert */ { async = /* nicht spezifiziert */, deferred = /* nicht spezifiziert */, /* implementierungsdefiniert */ }; enum class future_status { ready, timeout, deferred }; template<> struct is_error_code_enum<future_errc> : public true_type { }; error_code make_error_code(future_errc e) noexcept; error_condition make_error_condition(future_errc e) noexcept; const error_category& future_category() noexcept; class future_error; template<class R> class promise; template<class R> class promise<R&>; template<> class promise<void>; template<class R> void swap(promise<R>& x, promise<R>& y) noexcept; template<class R, class Alloc> struct uses_allocator<promise<R>, Alloc>; template<class R> class future; template<class R> class future<R&>; template<> class future<void>; template<class R> class shared_future; template<class R> class shared_future<R&>; template<> class shared_future<void>; template<class> class packaged_task; // nicht definiert template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>&, packaged_task<R(ArgTypes...)>&) noexcept; template<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(F&& f, Args&&... args); template<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(launch policy, F&& f, Args&&... args); }
Klasse std::future_error
namespace std { class future_error : public logic_error { public: explicit future_error(future_errc e); const error_code& code() const noexcept; const char* what() const noexcept; private: error_code ec_; // nur zur Darstellung }; }
Klassentemplate std::promise
namespace std { template<class R> class promise { public: promise(); template<class Allocator> promise(allocator_arg_t, const Allocator& a); promise(promise&& rhs) noexcept; promise(const promise&) = delete; ~promise(); // Zuweisung promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise&) = delete; void swap(promise& other) noexcept; // Abrufen des Ergebnisses future<R> get_future(); // Setzen des Ergebnisses void set_value(/* siehe Beschreibung */); void set_exception(exception_ptr p); // Setzen des Ergebnisses mit verzögerter Benachrichtigung void set_value_at_thread_exit(/* siehe Beschreibung */); void set_exception_at_thread_exit(exception_ptr p); }; template<class R> void swap(promise<R>& x, promise<R>& y) noexcept; template<class R, class Alloc> struct uses_allocator<promise<R>, Alloc>; }
Klassentemplate std::future
namespace std { template<class R> class future { public: future() noexcept; future(future&&) noexcept; future(const future&) = delete; ~future(); future& operator=(const future&) = delete; future& operator=(future&&) noexcept; shared_future<R> share() noexcept; // Abrufen des Werts /* siehe Beschreibung */ get(); // Funktionen zur Zustandsprüfung bool valid() const noexcept; void wait() const; template<class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template<class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; }; }
namespace std { template<class R> class shared_future { public: shared_future() noexcept; shared_future(const shared_future& rhs) noexcept; shared_future(future<R>&&) noexcept; shared_future(shared_future&& rhs) noexcept; ~shared_future(); shared_future& operator=(const shared_future& rhs) noexcept; shared_future& operator=(shared_future&& rhs) noexcept; // Abrufen des Werts /* siehe Beschreibung */ get() const; // Funktionen zur Zustandsprüfung bool valid() const noexcept; void wait() const; template<class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template<class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; }; }
Klassentemplate std::packaged_task
namespace std { template<class> class packaged_task; // nicht definiert template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { public: // Konstruktion und Destruktion packaged_task() noexcept; template<class F> explicit packaged_task(F&& f); ~packaged_task(); // Kein Kopieren packaged_task(const packaged_task&) = delete; packaged_task& operator=(const packaged_task&) = delete; // Move-Unterstützung packaged_task(packaged_task&& rhs) noexcept; packaged_task& operator=(packaged_task&& rhs) noexcept; void swap(packaged_task& other) noexcept; bool valid() const noexcept; // Ergebnisabruf future<R> get_future(); // Ausführung void operator()(ArgTypes... ); void make_ready_at_thread_exit(ArgTypes...); void reset(); }; template<class R, class... ArgTypes> packaged_task(R (*)(ArgTypes...)) -> packaged_task<R(ArgTypes...)>; template<class F> packaged_task(F) -> packaged_task</* siehe Beschreibung */>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept; }