Skip to main content

unary_op Struct Template

Common base struct template for unary comparators. More...

Declaration​

template <class T>
struct micro_os_plus::micro_test_plus::detail::unary_op<T> { ... }

Included Headers​

Base struct​

structop

Empty base struct for the framework expression types. More...

Derived Structs​

structnot_op<T>

Logical NOT comparator struct template. More...

structpredicate_op<T, Predicate_T>

Unary predicate struct template. More...

Public Member Typedefs Index​

template <class T>
usingop_type = op

Marker identifying the framework expression types. More...

Public Constructors Index​

template <class U>
constexprunary_op (U &&t, bool value)

Constructs a unary comparator with the given operand and pre-computed result. More...

Public Operators Index​

template <class T>
constexproperator 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>
Tt_

Stores the operand. More...

template <class T>
const boolvalue_ {}

Stores the result of the operation. More...

Description​

Common base struct template for unary comparators.

This base struct stores a single operand and the pre-computed boolean result of a unary operation. Derived structs such as not_op inherit from this to provide logical negation. The result is computed at construction time, enabling consistent handling and reporting of operations throughout the framework.

Template Parameters
T

The type of the stored operand, either the operand type, or a const reference to it (see stored_operand_t).

Definition at line 257 of file detail.h.

Public Member Typedefs​

op_type​

template <class T>
using micro_os_plus::micro_test_plus::detail::op::op_type = op

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.

128 using op_type = op;

Public Constructors​

unary_op()​

template <class U>
micro_os_plus::micro_test_plus::detail::unary_op< T >::unary_op (U && t, bool value)
constexpr

Constructs a unary comparator with the given operand and pre-computed result.

The operand is forwarded to the member, so that an rvalue is moved, not copied.

Template Parameters
U

The type of the operand argument.

Parameters
t

The operand.

value

The pre-computed boolean result of the operation.

Stores the operand and the pre-computed boolean result of the operation in the corresponding private members.

Declaration at line 273 of file detail.h, definition at line 117 of file detail-inlines.h.

117 constexpr unary_op<T>::unary_op (U&& t, bool value)
118 : t_{ std::forward<U> (t) }, value_{ value }
119 {
120 }

References micro_os_plus::micro_test_plus::detail::unary_op< T >::t_ and micro_os_plus::micro_test_plus::detail::unary_op< T >::value_.

Referenced by micro_os_plus::micro_test_plus::detail::not_op< T >::not_op, micro_os_plus::micro_test_plus::detail::predicate_op< T, Predicate_T >::predicate_op and micro_os_plus::micro_test_plus::detail::unary_op< T >::operator bool.

Public Operators​

operator bool()​

template <class T>
micro_os_plus::micro_test_plus::detail::unary_op< T >::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.

129 operator bool () const
130 {
131 return value_;
132 }

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()​

template <class T>
decltype(auto) constexpr micro_os_plus::micro_test_plus::detail::unary_op< T >::operand (void)
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.

142 {
143 return detail::unwrap (t_);
144 }

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_​

template <class T>
T micro_os_plus::micro_test_plus::detail::unary_op< T >::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.

309 T t_;

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_​

template <class T>
const bool micro_os_plus::micro_test_plus::detail::unary_op< T >::value_ {}

Stores the result of the operation.

Computed once, by the derived comparator constructor.

Definition at line 317 of file detail.h.

317 const bool value_{};

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.