1. 1
  1.  

  2. 2

    I was looking into this style of error handling last week. Currently the Outcome library looks like the best choice — it can be used standalone or with Boost, only requires C++14, and claims to be quite lightweight.

    The upcoming exception refresh in C++2x is going to be similar to these in architecture, but integrated into the language syntax so it looks more like try/catch, and probably faster since the ABI will allow for optimizations like using a CPU flag to indicate whether the return value is a result or an error.

    1. 1

      That’s cool! Do you have any more info on the exception refresh (eg. examples)? I’m not seeing how try/catch can work with stuff like StatusOr.

      1. 1

        I don’t have the URL it came from, but the working-group document is titled “Zero-overhead Deterministic Exceptions: Throwing Values”, by Herb Sutter.