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

A type that holds either a value or error information. More...

#include <core.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::ValueOrError = Resultable<T> && requires(const T t) {
{ t.value() };
{ t.error() };
}
A type that can contain either a value or an error.
Definition core.h:54
A type that holds either a value or error information.
Definition core.h:214

Detailed Description

A type that holds either a value or error information.

Types satisfying this concept can report their state and provide access to either the contained value or error details.

Example usage:

template<ValueOrError V>
void handle(const V& result) {
if (result.is_ok()) {
auto& val = result.value();
// Process value
} else {
auto& err = result.error();
// Handle error
}
}
const error_info & error() const
Get error reference.
Definition core.h:405
VoidResult err(const error_info &error)
Factory function to create error VoidResult.
Definition core.cppm:432

Definition at line 214 of file core.h.