not_op Struct Template
Logical NOT comparator struct template. More...
Declaration
struct micro_os_plus::micro_test_plus::detail::not_op<T> { ... }
Included Headers
Base struct
| struct | unary_op<T> |
|
Common base struct template for unary comparators. More... | |
Public Member Typedefs Index
template <class T> | |
| using | op_type = op |
|
Marker identifying the framework expression types. More... | |
Public Constructors Index
template <class U> | |
| constexpr | not_op (U &&t) |
|
Constructs a logical NOT comparator for the given operand. More... | |
Public Operators Index
template <class T> | |
| constexpr | operator bool () const |
|
Conversion operator to boolean. More... | |
Public Member Functions Index
template <class T> | |
| constexpr auto | operand (void) const -> decltype(auto) |
|
Retrieves the wrapped operand expression. More... | |
Private Member Attributes Index
template <class T> | |
| T | t_ |
|
Stores the operand. More... | |
template <class T> | |
| const bool | value_ {} |
|
Stores the result of the operation. More... | |
Description
Logical NOT comparator struct template.
Derived from unary_op, this struct negates a single sub-expression, enabling test writers to assert that a condition does not hold. The negation result is computed at construction time.
A temporary is moved into the comparator, and a named sub-expression is copied (see stored_operand_t).
There is no deduction guide: with a single argument that is itself a not_op, the class template argument deduction prefers the copy deduction candidate, so not_op{ inner } would copy inner instead of negating it. Name the template argument instead, as not_op<stored_operand_t<T>>{ t }.
- Template Parameters
-
T The type of the stored sub-expression, either its type, or a const reference to it.
Definition at line 1194 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
not_op()
| explicit constexpr |
Constructs a logical NOT comparator for the given operand.
The result is computed from the argument, before it is forwarded to the base. The constraint leaves the copies and the moves of a not_op to the implicit constructors.
- Template Parameters
-
U The type of the operand argument.
- Parameters
-
t The operand to be negated.
Evaluates the logical negation not static_cast<bool>(t) and passes the result to the unary_op base class constructor.
Declaration at line 1210 of file detail.h, definition at line 1077 of file detail-inlines.h.
References micro_os_plus::micro_test_plus::detail::not_op< T >::not_op and micro_os_plus::micro_test_plus::detail::unary_op< T >::unary_op.
Referenced by micro_os_plus::micro_test_plus::detail::not_op< T >::not_op.
Public Operators
operator bool()
| nodiscard constexpr |
Conversion operator to boolean.
- Parameters
None.
- Returns
The result of the operation.
Returns the pre-computed boolean result stored by the derived comparator's constructor.
Declaration at line 283 of file detail.h, definition at line 129 of file detail-inlines.h.
References micro_os_plus::micro_test_plus::detail::unary_op< T >::unary_op and micro_os_plus::micro_test_plus::detail::unary_op< T >::value_.
Public Member Functions
operand()
| nodiscard constexpr |
Retrieves the wrapped operand expression.
The operand is unwrapped with detail::unwrap() and returned by reference, so that formatting it does not copy it.
- Parameters
None.
- Returns
The extracted operand value.
Returns the operand, unwrapped by detail::unwrap() if it is a framework wrapper type; the stored operand is not copied.
Declaration at line 297 of file detail.h, definition at line 141 of file detail-inlines.h.
References micro_os_plus::micro_test_plus::detail::unary_op< T >::operand, micro_os_plus::micro_test_plus::detail::unary_op< T >::t_ and micro_os_plus::micro_test_plus::detail::unwrap.
Referenced by micro_os_plus::micro_test_plus::detail::unary_op< T >::operand.
Private Member Attributes
t_
|
Stores the operand.
A value, moved from a temporary or copied from a named operand, or, for a named operand that cannot be copied, a const reference to it (see stored_operand_t). It is not const, so that a temporary expression can be moved into an enclosing one.
Definition at line 309 of file detail.h.
Referenced by micro_os_plus::micro_test_plus::detail::unary_op< T >::unary_op and micro_os_plus::micro_test_plus::detail::unary_op< T >::operand.
value_
|
Stores the result of the operation.
Computed once, by the derived comparator constructor.
Definition at line 317 of file detail.h.
Referenced by micro_os_plus::micro_test_plus::detail::unary_op< T >::unary_op and micro_os_plus::micro_test_plus::detail::unary_op< T >::operator bool.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.