callable_op Struct
Common base struct for callable-wrapping operators. More...
Declaration
Included Headers
Base struct
| struct | op |
|
Empty base struct for the framework expression types. More... | |
Derived Structs
| struct | throws_op<void> |
|
Operator struct to check if an expression throws any exception. More... | |
| struct | nothrow_op |
|
Operator struct to check if an expression does not throw any exception. More... | |
| struct | throws_op<Exception_T> |
|
Operator struct template to check if an expression throws a specific exception. More... | |
| struct | throws_op<void> |
|
Operator struct to check if an expression throws any exception. More... | |
Public Member Typedefs Index
| using | op_type = op |
|
Marker identifying the framework expression types. More... | |
Public Constructors Index
| callable_op (callable_result &&result) | |
|
Constructs a callable operator with the pre-computed result. More... | |
Public Operators Index
| constexpr | operator bool () const |
|
Conversion operator to boolean. More... | |
Public Member Functions Index
| throw_outcome | outcome (void) const noexcept |
|
Retrieves what the invocation threw. More... | |
| const std::string & | what (void) const noexcept |
Private Member Attributes Index
| throw_outcome | outcome_ { throw_outcome::none } |
|
Stores what the invocation threw, when the check failed. More... | |
| const bool | value_ {} |
|
Stores the result of the callable invocation. More... | |
| std::string | what_ {} |
|
Stores the what() of the std::exception thrown, when the check failed. More... | |
Description
Common base struct for callable-wrapping operators.
The base of the exception-checking operators, throws_op and nothrow_op, which invoke the callable in their constructors. It stores the pre-computed boolean result, and, when the check failed, what was thrown, so that the report can state why (see expression_formatter::append_throw_reason()).
Definition at line 1402 of file detail.h.
Public Member Typedefs
op_type
|
Marker identifying the framework expression types.
Detected by the extension::is_op concept, and inherited by all types derived from op.
Definition at line 128 of file extension.h.
Public Constructors
callable_op()
| inline explicit |
Constructs a callable operator with the pre-computed result.
- Parameters
-
result The result of the invocation, with what was thrown.
Stores the pre-computed boolean result, and, when the check failed, what the invocation threw and the what() of the exception.
Declaration at line 1410 of file detail.h, definition at line 1125 of file detail-inlines.h.
References outcome, outcome_, value_, what and what_.
Referenced by micro_os_plus::micro_test_plus::detail::nothrow_op::nothrow_op, micro_os_plus::micro_test_plus::detail::throws_op< Exception_T >::throws_op and micro_os_plus::micro_test_plus::detail::throws_op< void >::throws_op.
Public Operators
operator bool()
| nodiscard constexpr |
Conversion operator to boolean.
- Parameters
None.
- Returns
The result of the callable invocation.
Returns the result computed by the constructor of the derived operator; the callable is not invoked again.
Declaration at line 1420 of file detail.h, definition at line 1137 of file detail-inlines.h.
Reference value_.
Public Member Functions
outcome()
| inline nodiscard noexcept |
Retrieves what the invocation threw.
- Parameters
None.
- Returns
The kind of the exception thrown, throw_outcome::none if the callable completed, or if the expected exception was thrown.
Returns what was recorded when the check failed.
Declaration at line 1432 of file detail.h, definition at line 1147 of file detail-inlines.h.
Reference outcome_.
Referenced by callable_op.
what()
| inline nodiscard noexcept |
Retrieves the what() of the std::exception thrown.
- Parameters
None.
- Returns
The text, empty unless the outcome is throw_outcome::std_exception.
Returns the text recorded when a std::exception was thrown.
Declaration at line 1443 of file detail.h, definition at line 1157 of file detail-inlines.h.
Reference what_.
Referenced by callable_op.
Private Member Attributes
outcome_
|
Stores what the invocation threw, when the check failed.
Copied from the callable_result by the constructor.
Definition at line 1461 of file detail.h.
Referenced by callable_op and outcome.
value_
|
Stores the result of the callable invocation.
Computed once, by the derived operator constructor, which invokes the callable.
Definition at line 1453 of file detail.h.
Referenced by callable_op and operator bool.
what_
|
Stores the what() of the std::exception thrown, when the check failed.
Moved from the callable_result by the constructor; empty in the usual case, so nothing is allocated.
Definition at line 1471 of file detail.h.
Referenced by callable_op and what.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.