Skip to main content

binary_op Struct Template

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

Declaration​

template <class Lhs_T, class Rhs_T>
struct micro_os_plus::micro_test_plus::detail::binary_op<Lhs_T, Rhs_T> { ... }

Included Headers​

Base struct​

structop

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

Derived Structs​

structand_op<Lhs_T, Rhs_T>

Logical AND comparator struct template. More...

structapprox_op<Lhs_T, Rhs_T, Epsilon_T>

Approximate comparator struct template. More...

structcompare_op<Lhs_T, Rhs_T, Compare_T>

Relational comparator struct template. More...

structor_op<Lhs_T, Rhs_T>

Logical OR comparator struct template. More...

Public Member Typedefs Index​

template <class Lhs_T, class Rhs_T>
usingop_type = op

Marker identifying the framework expression types. More...

Public Constructors Index​

template <class L, class R>
constexprbinary_op (L &&lhs, R &&rhs, bool value)

Constructs a binary comparator with the given operands and pre-computed result. More...

Public Operators Index​

template <class Lhs_T, class Rhs_T>
constexproperator bool () const

Conversion operator to boolean. More...

Public Member Functions Index​

template <class Lhs_T, class Rhs_T>
constexpr auto lhs (void) const -> decltype(auto)

Retrieves the left-hand operand. More...

template <class Lhs_T, class Rhs_T>
constexpr auto rhs (void) const -> decltype(auto)

Retrieves the right-hand operand. More...

Private Member Attributes Index​

template <class Lhs_T, class Rhs_T>
Lhs_Tlhs_

Stores the left-hand operand. More...

template <class Lhs_T, class Rhs_T>
Rhs_Trhs_

Stores the right-hand operand. More...

template <class Lhs_T, class Rhs_T>
const boolvalue_ {}

Stores the result of the comparison. More...

Description​

Common base struct template for binary comparators.

This base struct stores two operands (left-hand and right-hand) along with the pre-computed boolean result of a binary comparison. Derived structs such as compare_op, and_op, and or_op inherit from this to provide relational and logical operations. The comparison result is computed at construction time and stored, so that the reporters and the logical operations read it without evaluating the operands again.

Template Parameters
Lhs_T

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

Rhs_T

The type of the stored right-hand operand, either the operand type, or a const reference to it.

Definition at line 342 of file detail.h.

Public Member Typedefs​

op_type​

template <class Lhs_T, class Rhs_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​

binary_op()​

template <class L, class R>
micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::binary_op (L && lhs, R && rhs, bool value)
constexpr

Constructs a binary comparator with the given operands and pre-computed result.

The operands are forwarded to the members, so that the rvalues are moved, not copied.

Template Parameters
L

The type of the left-hand operand argument.

R

The type of the right-hand operand argument.

Parameters
lhs

The left-hand operand.

rhs

The right-hand operand.

value

The pre-computed boolean result of the comparison.

Stores the two operands and the pre-computed boolean result of the comparison in the corresponding private members.

Declaration at line 360 of file detail.h, definition at line 155 of file detail-inlines.h.

156 : lhs_{ std::forward<L> (lhs) }, rhs_{ std::forward<R> (rhs) },
157 value_{ value }
158 {
159 }

References micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::lhs, micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::lhs_, micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::rhs, micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::rhs_ and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::value_.

Referenced by micro_os_plus::micro_test_plus::detail::and_op< Lhs_T, Rhs_T >::and_op, micro_os_plus::micro_test_plus::detail::approx_op< Lhs_T, Rhs_T, Epsilon_T >::approx_op, micro_os_plus::micro_test_plus::detail::compare_op< Lhs_T, Rhs_T, Compare_T >::compare_op, micro_os_plus::micro_test_plus::detail::or_op< Lhs_T, Rhs_T >::or_op and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::operator bool.

Public Operators​

operator bool()​

template <class Lhs_T, class Rhs_T>
micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::operator bool ()
nodiscard constexpr

Conversion operator to boolean.

Parameters

None.

Returns

The result of the comparison.

Returns the pre-computed boolean result stored by the derived comparator's constructor.

Declaration at line 370 of file detail.h, definition at line 168 of file detail-inlines.h.

168 operator bool () const
169 {
170 return value_;
171 }

References micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::binary_op and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::value_.

Public Member Functions​

lhs()​

template <class Lhs_T, class Rhs_T>
decltype(auto) constexpr micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::lhs (void)
nodiscard constexpr

rhs()​

template <class Lhs_T, class Rhs_T>
decltype(auto) constexpr micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::rhs (void)
nodiscard constexpr

Private Member Attributes​

lhs_​

template <class Lhs_T, class Rhs_T>
Lhs_T micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::lhs_

Stores the left-hand 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 410 of file detail.h.

410 Lhs_T lhs_;

Referenced by micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::binary_op and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::lhs.

rhs_​

template <class Lhs_T, class Rhs_T>
Rhs_T micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::rhs_

Stores the right-hand operand.

Stored as the left-hand operand is.

Definition at line 418 of file detail.h.

418 Rhs_T rhs_;

Referenced by micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::binary_op and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::rhs.

value_​

template <class Lhs_T, class Rhs_T>
const bool micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::value_ {}

Stores the result of the comparison.

Computed once, by the derived comparator constructor.

Definition at line 426 of file detail.h.

426 const bool value_{};

Referenced by micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_T >::binary_op and micro_os_plus::micro_test_plus::detail::binary_op< Lhs_T, Rhs_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.