Raymond Chenยท
C++ futures part 2: The mental model for std::promise, std::packaged_task
TL;DR
C++ futures are easier to understand when you view them as handles to shared state holding a result or exception. A std::promise fills that state directly, while std::packaged_task stores a callable and fills it when invoked, letting a future retrieve the outcome later.
Relevant links
Sign in to save links