mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-27 05:16:18 +08:00
added explicit ref-qualifiers for Error::what() and a additional overload to allow moving Error::what_ to caller if Error is an rvalue (#505)
This commit is contained in:
@@ -30,7 +30,9 @@ class Error {
|
||||
Error& operator=(Error&&) = default;
|
||||
|
||||
/// Returns the error message, equivalent to .what() in std::exception.
|
||||
const std::string& what() const { return what_; }
|
||||
const std::string& what() const & { return what_; }
|
||||
/// Moves the error message out of Error object and leaves what_ in a moved from state
|
||||
std::string what() && { return std::move(what_); }
|
||||
|
||||
private:
|
||||
/// Documents what went wrong
|
||||
|
||||
Reference in New Issue
Block a user