|
cgrapht 1.0.0
A modern C++20 header-only graph library
|
Result wrapper for success or error values. More...
#include <models.hpp>
Public Member Functions | |
| bool | operator== (const Result &other) const |
| Equality comparison based on status and payload. | |
| bool | is_ok () const |
| Check if the result represents success. | |
| const SUCCESS & | get_ok () const & |
| Access success value as const reference. | |
| SUCCESS | consume_ok () && |
| Move success value out of the result. | |
| const ERROR & | get_error () const & |
| Access error value as const reference. | |
| ERROR | consume_error () && |
| Move the error value out of the result. | |
Static Public Member Functions | |
| static Result | success (const SUCCESS &s) |
| Construct a success result from a const reference. | |
| static Result | success (SUCCESS &&s) |
| Construct a success result from an rvalue. | |
| static Result | error (const ERROR &e) |
| Construct an error result from a const reference. | |
| static Result | error (ERROR &&e) |
| Construct an error result from an rvalue. | |
Result wrapper for success or error values.
| SUCCESS | Success value type. |
| ERROR | Error value type. |
Definition at line 18 of file models.hpp.
|
inline |
Move the error value out of the result.
| std::runtime_error | if this is a success result. |
Definition at line 127 of file models.hpp.
References cgrapht::Result< SUCCESS, ERROR >::is_ok().
|
inline |
Move success value out of the result.
| std::runtime_error | if this is an error result. |
Definition at line 103 of file models.hpp.
References cgrapht::Result< SUCCESS, ERROR >::is_ok().
|
inlinestatic |
Construct an error result from a const reference.
| e | Error value. |
Definition at line 52 of file models.hpp.
Referenced by cgrapht::DirectedGraph< V, E >::add_edge(), cgrapht::DirectedGraph< V, E >::delete_edge(), cgrapht::DirectedGraph< V, E >::delete_vertex(), and cgrapht::DirectedGraph< V, E >::get_vertex().
|
inlinestatic |
Construct an error result from an rvalue.
| e | Error value. |
Definition at line 64 of file models.hpp.
|
inline |
Access error value as const reference.
| std::runtime_error | if this is a success result. |
Definition at line 115 of file models.hpp.
References cgrapht::Result< SUCCESS, ERROR >::is_ok().
|
inline |
Access success value as const reference.
| std::runtime_error | if this is an error result. |
Definition at line 91 of file models.hpp.
|
inline |
Check if the result represents success.
Definition at line 82 of file models.hpp.
Referenced by cgrapht::Result< SUCCESS, ERROR >::consume_error(), cgrapht::Result< SUCCESS, ERROR >::consume_ok(), and cgrapht::Result< SUCCESS, ERROR >::get_error().
|
inline |
Equality comparison based on status and payload.
Definition at line 74 of file models.hpp.
|
inlinestatic |
Construct a success result from a const reference.
| s | Success value. |
Definition at line 30 of file models.hpp.
Referenced by cgrapht::DirectedGraph< V, E >::add_edge(), cgrapht::DirectedGraph< V, E >::add_vertex(), cgrapht::DirectedGraph< V, E >::delete_edge(), cgrapht::DirectedGraph< V, E >::delete_vertex(), and cgrapht::DirectedGraph< V, E >::get_vertex().
|
inlinestatic |
Construct a success result from an rvalue.
| s | Success value. |
Definition at line 41 of file models.hpp.