From http://www.cplusplus.com/reference/future/promise/get_future/:
After this function has been called, the promise is expected to make its shared state ready at some point [...]
I'm unsure if this implies that this order of operations is mandatory:
- get_future()
- set_value()
Would it also be possible to get the future from the promise only after a value has been set?
set_value
beforeget_future
? – Anathematizeget_future
&set_value
may produce a data race. – Wheelwork