← Sunday, October 18, 2026Languages & toolsGuide
C++ futures distinguish single-consumer and shared results
std::future is move-only and consumes its result through get(), while shared_future is copyable and lets multiple consumers retrieve a reference to shared storage. The distinction matters when designing asynchronous APIs and choosing how results are handed between components.
- What
- std::future is a move-only C++ type for a single consumer; std::shared_future is copyable and supports multiple consumers.
- How
- std::future::get consumes the value once, while shared_future::get returns a const reference that each copy can retrieve repeatedly.
- Why it matters
- Choosing between them affects ownership and whether consumers can modify or move from a result, especially when the value is move-only.
Read on devblogs.microsoft.com →
Discussion
Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.
Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.