Commit 3a15ef9d authored by Dominik Charousset's avatar Dominik Charousset

Fix `to_string` for `expected<void>`

parent 87cc725a
...@@ -438,6 +438,12 @@ std::string to_string(const expected<T>& x) { ...@@ -438,6 +438,12 @@ std::string to_string(const expected<T>& x) {
return "!" + to_string(x.error()); return "!" + to_string(x.error());
} }
inline std::string to_string(const expected<void>& x) {
if (x)
return "unit";
return "!" + to_string(x.error());
}
/// @cond PRIVATE /// @cond PRIVATE
/// Assigns the value of `expr` (which must return an `expected`) /// Assigns the value of `expr` (which must return an `expected`)
/// to a new variable named `var` or throws a `std::runtime_error` on error. /// to a new variable named `var` or throws a `std::runtime_error` on error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment