Namespace

Before we begin

Outcome v2 namespace It is recommended that you refer to entities from this Outcome v2 via the following namespace alias: namespace outcome = OUTCOME_V2_NAMESPACE; View this code on Github On standalone Outcome only, as patches and modifications are applied to this library, namespaces get permuted in order to not to cause binary incompatibility. At some point namespace outcome_v2 will be defined, and this will be the preferred namespace. Until then OUTCOME_V2_NAMESPACE denotes the most recently updated version, getting closer to outcome_v2. »

result<>

We will define a function that converts a std::string to an int. This function can fail for a number of reasons; if it does we want to communicate the failure reason. outcome::result<int> convert(const std::string& str) noexcept; View this code on Github Template alias result<T, E = varies, NoValuePolicy = policy::default_policy<T, E, void>> has three template parameters, but the last two have default values. The first (T) represents the type of the object returned from the function upon success. »