Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3bdf7dba54.
PrevUpHomeNext

when_any, a dubious alternative

Certain topics in C++ can arouse strong passions, and exceptions are no exception. We cannot resist mentioning — for purely informational purposes — that when you need only the first result from some number of concurrently-running fibers, it would be possible to pass a shared_ptr<promise<>> to the participating fibers, then cause the initiating fiber to call future::get() on its future<>. The first fiber to call promise::set_value() on that shared promise will succeed; subsequent set_value() calls on the same promise instance will throw future_error.

Use this information at your own discretion. Beware the dark side.


PrevUpHomeNext