Nodiscard

Inspecting result<T, EC>

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