Skip to main content

can_compare Concept

Satisfied if the comparison selected by Op of two const objects is well-formed. More...

Definition​

template <comparison Op, class Lhs_T, class Rhs_T>
concept micro_os_plus::micro_test_plus::detail::comparison_lookup::can_compare = (Op == comparison::equal
             and requires (const Lhs_T& lhs, const Rhs_T& rhs) { lhs == rhs; })
            or (Op == comparison::not_equal
                and requires (const Lhs_T& lhs,
                              const Rhs_T& rhs) { lhs != rhs; })
            or (Op == comparison::greater
                and requires (const Lhs_T& lhs,
                              const Rhs_T& rhs) { lhs > rhs; })
            or (Op == comparison::greater_equal
                and requires (const Lhs_T& lhs,
                              const Rhs_T& rhs) { lhs >= rhs; })
            or (Op == comparison::less
                and requires (const Lhs_T& lhs,
                              const Rhs_T& rhs) { lhs < rhs; })
            or (Op == comparison::less_equal
                and requires (const Lhs_T& lhs, const Rhs_T& rhs) {
                      lhs <= rhs;
                    })

Description​

Satisfied if the comparison selected by Op of two const objects is well-formed.

Only the requirement of the selected operator is checked, so that, for example, eq() accepts the types that have only an operator==.

Template Parameters
Op

The comparison.

Lhs_T

The type of the left hand side operand.

Rhs_T

The type of the right hand side operand.

Definition at line 466 of file detail-inlines.h.

  template<comparison Op, class Lhs_T, class Rhs_T>
  concept can_compare = (Op == comparison::equal
  and requires (const Lhs_T& lhs, const Rhs_T& rhs) { lhs == rhs; })
  or (Op == comparison::not_equal
  and requires (const Lhs_T& lhs,
  const Rhs_T& rhs) { lhs != rhs; })
  or (Op == comparison::greater
  and requires (const Lhs_T& lhs,
  const Rhs_T& rhs) { lhs > rhs; })
  or (Op == comparison::greater_equal
  and requires (const Lhs_T& lhs,
  const Rhs_T& rhs) { lhs >= rhs; })
  or (Op == comparison::less
  and requires (const Lhs_T& lhs,
  const Rhs_T& rhs) { lhs < rhs; })
  or (Op == comparison::less_equal
  and requires (const Lhs_T& lhs, const Rhs_T& rhs) {
  lhs <= rhs;
  })

Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.