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

Prev Up HomeNext

value_or_none<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, and a public .value() 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 optional-like types such as std::optional<T> . Note it also matches P0323 std::expected<T, E> , which also has an optional-like interface. You may thus wish to preferentially match concepts::value_or_error<T, E> for any given T.

Namespace: BOOST_OUTCOME_V2_NAMESPACE::concepts

Header: <boost/outcome/convert.hpp>

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

Last revised: December 15, 2020 at 12:22:39 UTC


Prev Up HomeNext