Nodiscard

Inspecting result<T, EC>

Suppose we will be writing function print_half that takes an integral number (however big) represented as an std::string and outputs a number which is twice smaller: outcome::result<void> print_half(const std::string& text); View this code on Github Type result<void> means that there is no value to be retuned upon success, but that the operation might still fail, and we may be interested in inspecting the cause of the failure. Class template result<> is declared with attribute [[nodiscard]], which means compiler will warn you if you forget to inspect the returned object (in C++ 17 or later). »