Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::OptionalLike Concept Referenceexport

A type that represents an optional value (present or absent). More...

#include <core.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::OptionalLike = requires(const T t) {
{ t.has_value() } -> std::convertible_to<bool>;
{ t.is_some() } -> std::convertible_to<bool>;
{ t.is_none() } -> std::convertible_to<bool>;
}
A type that represents an optional value (present or absent).
Definition core.h:163

Detailed Description

A type that represents an optional value (present or absent).

Types satisfying this concept provide has_value(), is_some(), and is_none() methods for querying the presence of a value.

Example usage:

template<OptionalLike O>
void process_if_present(const O& opt) {
if (opt.has_value()) {
// Use opt.value()
}
}

Definition at line 163 of file core.h.