← Sunday, October 18, 2026Languages & toolsGuide

C++ futures distinguish single-consumer and shared results

devblogs.microsoft.com by Raymond Chen Editor score 6/10

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.
value shared() result refere… source std::future std::shared_fut…
A future and shared_future provide different ways to retrieve a value from the source. Sketched from the article's own text.

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.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.