Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
bool is_ok() const { return this->t != nullopt; }
bool is_err() const { return this->e != nullptr; }
bool is_ok() const { return this->t != nullopt; }
bool is_err() const { return this->e != nullptr; }
- T unwrap() { return this->t.value(); }
+ T unwrap() {
+ if (this->e != nullptr) {
+ throw std::logic_error(this->e);
+ }
+ return this->t.value();
+ }
+
+ operator T() {
+ return this->unwrap();
+ }
char const *unwrap_err() { return this->e; }
};
char const *unwrap_err() { return this->e; }
};