Skip to main content

The ge_ Struct Template Reference

Greater than or equal comparator struct template. More...

Declaration

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

Included Headers

Base struct

structop

Empty base struct for all operator types. More...

Public Constructors Index

template <class Lhs_T, class Rhs_T>
constexprge_ (const Lhs_T &lhs={}, const Rhs_T &rhs={})

Constructs a greater than or equal comparator for the given operands. 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 autolhs (void) const

Retrieves the left-hand operand. More...

template <class Lhs_T, class Rhs_T>
constexpr autorhs (void) const

Retrieves the right-hand operand. More...

Public Member Attributes Index

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

Stores the left-hand operand. More...

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

Stores the right-hand operand. More...

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

Stores the result of the greater than or equal comparison. More...

Description

Greater than or equal comparator struct template.

Template Parameters
Lhs_T

The type of the left-hand operand.

Rhs_T

The type of the right-hand operand.

The ge_ struct template provides a type-safe mechanism for evaluating whether the left-hand operand is greater than or equal to the right-hand operand within the framework.

This comparator supports a variety of operand types, including those with static values and generic types. For types with static values, the comparison is performed directly. For all other types, the generic getter is used to retrieve and compare the values.

The implementation is optimised for use in embedded environments and supports both compile-time and run-time evaluation.

All definitions are intended for internal use within the framework and are implemented in the include/micro-os-plus folder to maintain a structured and modular codebase.

Definition at line 737 of file detail.h.

Public Constructors

ge_()

template <class Lhs_T, class Rhs_T>
micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::ge_ (const Lhs_T & lhs={}, const Rhs_T & rhs={})
inline constexpr

Constructs a greater than or equal comparator for the given operands.

Parameters
lhs

The left-hand operand.

rhs

The right-hand operand.

Evaluates whether the left-hand operand is greater than or equal to the right-hand operand at construction, supporting static values and generic types. The result is stored in the value_ member for efficient access.

Definition at line 752 of file detail.h.

752 constexpr ge_ (const Lhs_T& lhs = {}, const Rhs_T& rhs = {})
753 : lhs_{ lhs }, rhs_{ rhs }, value_{ [&] {
754 using std::operator>=;
755
756#if defined(__GNUC__)
757#pragma GCC diagnostic push
758#pragma GCC diagnostic ignored "-Wconversion"
759#pragma GCC diagnostic ignored "-Wdouble-promotion"
760#pragma GCC diagnostic ignored "-Wsign-compare"
761#if defined(__clang__)
762#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
763#pragma clang diagnostic ignored "-Wpedantic"
764#endif
765#endif
768 {
769 return Lhs_T::value >= Rhs_T::value;
770 }
771 else
772 {
773 return get (lhs_) >= get (rhs_);
774 }
775#if defined(__GNUC__)
776#pragma GCC diagnostic pop
777#endif
778 }() }
779 {
780 }

Reference micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::lhs.

Public Operators

operator bool()

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

Conversion operator to boolean.

Parameters

None.

Return Values
true

The left-hand operand is greater than or equal to the right-hand operand.

false

Otherwise.

Returns the result of the greater than or equal comparison.

Definition at line 795 of file detail.h.

795 operator bool () const
796 {
797 return value_;
798 }

Reference micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::value_.

Public Member Functions

lhs()

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

Retrieves the left-hand operand.

Parameters

None.

Returns

The extracted left-hand operand.

Returns the value of the left-hand operand, applying the generic getter to ensure correct extraction for both custom and standard types.

Definition at line 813 of file detail.h.

813 lhs (void) const
814 {
815 return get (lhs_);
816 }

References micro_os_plus::micro_test_plus::detail::get and micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::lhs_.

Referenced by micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::ge_ and micro_os_plus::micro_test_plus::test_reporter::operator<<.

rhs()

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

Retrieves the right-hand operand.

Parameters

None.

Returns

The extracted right-hand operand.

Returns the value of the right-hand operand, applying the generic getter to ensure correct extraction for both custom and standard types.

Definition at line 831 of file detail.h.

831 rhs (void) const
832 {
833 return get (rhs_);
834 }

References micro_os_plus::micro_test_plus::detail::get and micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::rhs_.

Referenced by micro_os_plus::micro_test_plus::test_reporter::operator<<.

Public Member Attributes

lhs_

template <class Lhs_T, class Rhs_T>
const Lhs_T micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::lhs_ {}

Stores the left-hand operand.

Definition at line 839 of file detail.h.

839 const Lhs_T lhs_{};

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

rhs_

template <class Lhs_T, class Rhs_T>
const Rhs_T micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::rhs_ {}

Stores the right-hand operand.

Definition at line 844 of file detail.h.

844 const Rhs_T rhs_{};

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

value_

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

Stores the result of the greater than or equal comparison.

Definition at line 849 of file detail.h.

849 const bool value_{};

Referenced by micro_os_plus::micro_test_plus::detail::ge_< Lhs_T, Rhs_T >::operator bool.


The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus by Doxygen 1.14.0.