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 all operator types. More...

Derived Structs

structnot_<T>

Logical NOT comparator struct template. More...

Public Constructors Index

template <class T>
constexprunary_op_ (const T &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 autooperand () const

Retrieves the wrapped operand expression. More...

Private Member Attributes Index

template <class T>
const 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_ inherit from this to provide logical negation. The result is computed at construction time, enabling consistent handling and reporting of operations throughout the assertion framework.

Template Parameters
T

The type of the operand.

Definition at line 161 of file detail.h.

Public Constructors

unary_op_()

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

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

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 170 of file detail.h, definition at line 97 of file detail-inlines.h.

97 constexpr unary_op_<T>::unary_op_ (const T& t, bool value)
98 : t_{ t }, value_{ value }
99 {
100 }

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_< T >::not_ 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 180 of file detail.h, definition at line 109 of file detail-inlines.h.

109 operator bool () const
110 {
111 return value_;
112 }

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>
auto micro_os_plus::micro_test_plus::detail::unary_op_< T >::operand ()
nodiscard constexpr

Retrieves the wrapped operand expression.

Parameters

None.

Returns

The extracted operand value.

Returns the wrapped operand, applying the generic getter to ensure correct extraction for both custom and standard types.

Declaration at line 190 of file detail.h, definition at line 121 of file detail-inlines.h.

122 {
123 return get (t_);
124 }

References micro_os_plus::micro_test_plus::detail::get and micro_os_plus::micro_test_plus::detail::unary_op_< T >::t_.

Referenced by micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<.

Private Member Attributes

t_

template <class T>
const T micro_os_plus::micro_test_plus::detail::unary_op_< T >::t_ {}

value_

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

Stores the result of the operation.

Definition at line 201 of file detail.h.

201 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.0 by Doxygen 1.17.0.