Talk:cpp/thread/future
§ 30.6.6.3 States "The effect of calling any member function other than the destructor, the move-assignment operator, or valid on a future object for which valid() == false is undefined. [ Note: Implementations are encouraged to detect this case and throw an object of type future_error with an error condition of future_errc::no_state. —end note ]"
I would like to add something akin to the following paragraph in the appropriate member functions' pages (share, get, wait, wait_for, and wait_until):
A precondition of this function is that valid()== true. If this is not met, Standard Library implementations are encouraged to throw a future_error with an error condition of future_errc::no_state.
However, I'm not sure if mentioning the contents of the Note are appropriate, and if so, should that be added to an "Exceptions" section?
Fraser 18:15, 13 January 2013 (PST)
- I think that would be a good addition, but perhaps it would most naturally fit under a "Notes" section on each page (see e.g. http://en.cppreference.com/w/cpp/string/basic_string/c_str). --Nate 15:03, 14 January 2013 (PST)
- Thanks for the tip. Added under "Notes" now. Fraser 16:42, 14 January 2013 (PST)
--AhmedHan (talk) 23:52, 6 September 2018 (PDT) All of the examples work with lambda expressions. Why don't we put some realistic example code which runs with a member function.