On Thu, Nov 9, 2023 at 9:41 PM Andrzej Krzemienski via Boost
Hi Everyone, I would like to discuss one correctness aspect of Boost.COBALT. We have this list and the Slack channel, so I am not sure which place is better. Let me do it here.
I don't see why this is a correctness issue and not a design choice. When is it correct to use an exception?
In Boost.Cobalt (formerly Boost.Async) we have function cobalt::race (formerly select()) that takes a range of awaitables `p` and returns an awaitable capable on awaiting on one of the elements of `p`:
https://www.boost.org/doc/libs/develop/libs/cobalt/doc/html/index.html#race-...
Example:
``` promise<string> talk_to_server_1(); promise<string> talk_to_server_2(); promise<string> timeout_with_default();
vector
servers = { talk_to_server_1(), talk_to_server_2(), timeout_with_default() }; pair ans = co_await race(servers); ``` This obviously cannot work when the input range passed to `race` is empty.
This example doesn't help, because this should obviously use the
variadic version.
The reason to use the ranged one is for when you have another
component dictating what elements to listen to.
try
{
vector