#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.
◆ 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.
◆ 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. |
◆ operator!=() [1/3]
template<typename T , typename U >
◆ operator!=() [2/3]
template<typename T , typename U >
| bool operator!= |
( |
expect< T > const & |
lhs, |
|
|
U const & |
rhs |
|
) |
| |
|
inlinenoexcept |
◆ operator!=() [3/3]
template<typename T , typename U >
| bool operator!= |
( |
T const & |
lhs, |
|
|
expect< U > const & |
rhs |
|
) |
| |
|
inlinenoexcept |
◆ operator==() [1/3]
template<typename T , typename U >
◆ operator==() [2/3]
template<typename T , typename U >
| bool operator== |
( |
expect< T > const & |
lhs, |
|
|
U const & |
rhs |
|
) |
| |
|
inlinenoexcept |
◆ operator==() [3/3]
template<typename T , typename U >
| bool operator== |
( |
T const & |
lhs, |
|
|
expect< U > const & |
rhs |
|
) |
| |
|
inlinenoexcept |
◆ success()
- Returns
- An
expect<void> object with !has_error().