fix status_or value_or

This commit is contained in:
tqcq 2024-03-18 16:42:37 +08:00
parent b23f0c35e0
commit 8227f8f589

View File

@ -108,21 +108,25 @@ public:
T &value_or(T &&val) & T &value_or(T &&val) &
{ {
if (!ok()) return val; if (!ok()) return val;
return **this;
} }
T const &value_or(T &&val) const & T const &value_or(T &&val) const &
{ {
if (!ok()) return val; if (!ok()) return val;
return **this;
} }
T &&value_or(T &&val) && T &&value_or(T &&val) &&
{ {
if (!ok()) return val; if (!ok()) return val;
return std::move(**this);
} }
T const &&value_or(T &&val) const && T const &&value_or(T &&val) const &&
{ {
if (!ok()) return val; if (!ok()) return val;
return std::move(**this);
} }
Status const &status() const & { return status_; } Status const &status() const & { return status_; }