#include <cassert>
#include <system_error>
#include <type_traits>
#include <utility>
#include "common/error.h"
Go to the source code of this file.
|
| | detail |
| | declaration and default definition for the functions used the API
|
| |
|
| expect< void > | success () noexcept |
| |
| template<typename T , typename U > |
| bool | operator== (expect< T > const &lhs, expect< U > const &rhs) noexcept(noexcept(lhs.equal(rhs))) |
| |
| template<typename T , typename U > |
| bool | operator== (expect< T > const &lhs, U const &rhs) noexcept(noexcept(lhs.equal(rhs))) |
| |
| template<typename T , typename U > |
| bool | operator== (T const &lhs, expect< U > const &rhs) noexcept(noexcept(rhs.equal(lhs))) |
| |
| template<typename T , typename U > |
| bool | operator!= (expect< T > const &lhs, expect< U > const &rhs) noexcept(noexcept(lhs.equal(rhs))) |
| |
| template<typename T , typename U > |
| bool | operator!= (expect< T > const &lhs, U const &rhs) noexcept(noexcept(lhs.equal(rhs))) |
| |
| template<typename T , typename U > |
| bool | operator!= (T const &lhs, expect< U > const &rhs) noexcept(noexcept(rhs.equal(lhs))) |
| |
◆ ELECTRONEUM_CHECK
| #define ELECTRONEUM_CHECK |
( |
|
... | ) |
|
Value:do \
{ \
const ::expect<void> result = __VA_ARGS__ ; \
if (!result) \
return result.error(); \
} while (0)
Check expect<void> and return errors in current scope.
Definition at line 47 of file expect.h.
◆ ELECTRONEUM_PRECOND
| #define ELECTRONEUM_PRECOND |
( |
|
... | ) |
|
Value:do \
{ \
if (!( __VA_ARGS__ )) \
return {::common_error::kInvalidArgument}; \
} while (0)
If precondition fails, return ::error::kInvalidArgument in current scope.
Definition at line 39 of file expect.h.
◆ ELECTRONEUM_THROW
◆ ELECTRONEUM_UNWRAP
Get T from expect<T> by std::move as-if by function call. expect<void> returns nothing.
- Exceptions
-
| std::system_error | with expect<T>error(), filename and line number when expect<T>::has_error() == true. |
Definition at line 60 of file expect.h.
◆ operator!=() [1/3]
template<typename T , typename U >
Definition at line 422 of file expect.h.
424 return !lhs.
equal(rhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ operator!=() [2/3]
template<typename T , typename U >
| bool operator!= |
( |
expect< T > const & |
lhs, |
|
|
U const & |
rhs |
|
) |
| |
|
inlinenoexcept |
Definition at line 429 of file expect.h.
431 return !lhs.
equal(rhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ operator!=() [3/3]
template<typename T , typename U >
| bool operator!= |
( |
T const & |
lhs, |
|
|
expect< U > const & |
rhs |
|
) |
| |
|
inlinenoexcept |
Definition at line 436 of file expect.h.
438 return !rhs.
equal(lhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ operator==() [1/3]
template<typename T , typename U >
Definition at line 401 of file expect.h.
403 return lhs.
equal(rhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ operator==() [2/3]
template<typename T , typename U >
| bool operator== |
( |
expect< T > const & |
lhs, |
|
|
U const & |
rhs |
|
) |
| |
|
inlinenoexcept |
Definition at line 408 of file expect.h.
410 return lhs.
equal(rhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ operator==() [3/3]
template<typename T , typename U >
| bool operator== |
( |
T const & |
lhs, |
|
|
expect< U > const & |
rhs |
|
) |
| |
|
inlinenoexcept |
Definition at line 415 of file expect.h.
417 return rhs.
equal(lhs);
bool equal(expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< T >>()== *rhs))
◆ success()
- Returns
- An
expect<void> object with !has_error().
Definition at line 397 of file expect.h.