Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 88d8cda16e.
Prev Up HomeNext

value_or_error<T>

If on C++ 20 or the Concepts TS is enabled, a boolean concept matching types with a public .has_value() observer which returns bool, a public .value() observer function, and a public .error() observer function.

If without Concepts, a static constexpr bool which is true for types matching the same requirements, using a SFINAE based emulation.

This concept matches expected-like types such as P0323 std::expected<T, E> , one of which is basic_result<T, E, NoValuePolicy> . Be aware it does not differentiate between value-or-error types and value-and-error types if they present the interface matched above.

If you want a concept matching specifically basic_result<T, E, NoValuePolicy> , see basic_result<T> .

Namespace: BOOST_OUTCOME_V2_NAMESPACE::concepts

Header: <boost/outcome/convert.hpp>

Legacy: This was named convert::ValueOrError<T> in Outcome v2.1 and earlier. Define BOOST_OUTCOME_ENABLE_LEGACY_SUPPORT_FOR to less than 220 to enable.

Last revised: August 19, 2020 at 12:15:40 +0100


Prev Up HomeNext