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

A type that can contain either a value or an error. More...

#include <core.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::Resultable = requires(const T t) {
{ t.is_ok() } -> std::convertible_to<bool>;
{ t.is_err() } -> std::convertible_to<bool>;
}
A type that can contain either a value or an error.
Definition core.h:54

Detailed Description

A type that can contain either a value or an error.

Types satisfying this concept provide is_ok() and is_err() methods to query the state of the result.

Example usage:

template<Resultable R>
void process(const R& result) {
if (result.is_ok()) {
// Handle success
} else {
// Handle error
}
}
void process(const T &value)

Definition at line 54 of file core.h.