acl/core/error_result.h¶
#include "acl/core/error_result.h"
The result of a function that can fail.
error_result¶
class error_result
This class is meant to encapsulate a simple error message and easily coerce with bool in order to simplify and clean up error handling. In an ideal world, I would love for a C++11 equivalent of std::result in Rust.
error_result::error_result¶
error_result()
Constructs a result without an error.
explicit error_result(const char* error)
Constructs a result with the given error message. The string must stay valid as long as the result uses it.
error_result::empty¶
bool empty() const
Returns true if there is no error.
error_result::any¶
bool any() const
Returns true if there is an error.
error_result::c_str¶
const char* c_str() const
Returns the error message, or "" if there is no error.
error_result::reset¶
void reset()
Removes the error.