Another thing to notice about the preceding diagram is that the shared state doesn't just contain an optional<T>; it actually contains a variant<T, exception_ptr> (for variant and optional, see Chapter 5, Vocabulary Types). This implies that not only can you shove data of type T through the wormhole; you can also shove exceptions through. This is particularly convenient and symmetrical because it allows std::future<T> to represent all the possible outcomes of calling a function with the signature T(). Maybe it returns a T; maybe it throws an exception; and of course maybe it never returns at all. Similarly, a call to f.get() may return a T; or throw an exception; or (if the promise-holding thread loops forever) might never return at all. In order to shove an exception through the wormhole, you'd use the method p.set_exception...
Germany
Slovakia
Canada
Brazil
Singapore
Hungary
Philippines
Mexico
Thailand
Ukraine
Luxembourg
Estonia
Lithuania
Norway
Chile
United States
Great Britain
India
Spain
South Korea
Ecuador
Colombia
Taiwan
Switzerland
Indonesia
Cyprus
Denmark
Finland
Poland
Malta
Czechia
New Zealand
Austria
Turkey
France
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Malaysia
South Africa
Netherlands
Bulgaria
Latvia
Australia
Japan
Russia