53 explicit operator bool()
const {
return ok(); }
63 const std::string&
message()
const {
return message_; }
73 : value_(std::move(
value)), status_(std::move(
status)) {}
87 bool ok()
const {
return status_.
ok(); }
89 explicit operator bool()
const {
return ok(); }
96 const T&
value()
const {
return value_; }
const T & value() const
Access the contained value.
static Result< T > error(ErrorCode code, std::string message)
Construct an error result.
Result(T value, Status status=Status::success())
bool ok() const
True when result status is success.
const Status & status() const
Access the operation status.
static Status success()
Construct a success status.
static Status error(ErrorCode code, std::string message)
Construct an error status with code and message.
const std::string & message() const
Return the human-readable error message.
Status(ErrorCode code, std::string message)
ErrorCode code() const
Return the stable error code.
bool ok() const
True when status code is ErrorCode::Ok.
ErrorCode
Stable error codes returned by high-level API operations.