• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1+++
2title = "`ValueOrNone<T>`"
3description = "A boolean concept matching types with an optional value."
4+++
5
6If 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.
7
8If without Concepts, a static constexpr bool which is true for types matching the same requirements, using a SFINAE based emulation.
9
10This concept matches optional-like types such as {{% api "std::optional<T>" %}}. Note it also matches {{% api "std::expected<T, E>" %}}, which also has an optional-like interface. You may thus wish to preferentially match {{% api "ValueOrError<T, E>" %}} for any given `T`.
11
12*Namespace*: `BOOST_OUTCOME_V2_NAMESPACE::convert`
13
14*Header*: `<boost/outcome/convert.hpp>`