Namespaces
Variants
Actions

Talk:cpp/thread/shared future/valid

From cppreference.com

[edit] Multiple .get()s in shared_future

Isn't "Checks if the future refers to a shared state. This is the case only ... until the first time get() is called." wrong?

According to C++11 e.g. Draft N3376 (and N3485, I'm sorry don't have the money for the actual standard, yet)

§30.6.6 :18 future::get() indeed has the post condition "valid() == false" but shared_future::get() in §30.6.7 does not (no postcondition after line 20/throw condidtion) Superlokkus (talk) 05:26, 1 September 2015 (PDT)

It is likely that this page was initially written for std::future and then overlooked when templatized to be linked to by both std::shared_future and std::future. Good catch. I updated it to mention when the two kinds of futures are valid, separately. --Cubbi (talk) 06:07, 1 September 2015 (PDT)