Boost logo

Boost :

From: Bjorn Reese (breese_at_[hidden])
Date: 2020-06-01 17:23:05

On 2020-05-31 20:27, Emil Dotchevski via Boost wrote:

> That said, it is easy to provide the functionality Bjorn asked for. It'd be
> nice to see a use case though, I've never needed it.

There are no additional functional use cases per se, but am primarily
coming from the noexcept use cases on embedded devices, where I am more
interested in an inexpensive, non-allocating error propagation mechanism
than modelling exception-like structures.

The index/get API is intended to address various concerns with the
pattern matching API. The advantages are:

Single-step debugging becomes easy.

Compiler error-messages becomes more readable.

Code becomes easier to review because it relies on familiar C++
constructs such as if- and switch-statements.

Faster performance of normal path. I wrote a quick implementation of
get<I>() based on peek<T>() as you suggested, and index() was
implemented as a recursive search through the tuple for the error_id.
My benchmark shows that the happy-path is faster with index/get than
with try_handle_all().

Boost list run by bdawes at, gregod at, cpdaniel at, john at