Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::full_ordering_operators_from_less_than< Derived, Other > Class Template Reference

Helper class that can be inherited from by a class to define the >, <=, >=, == and != operators in terms of a < operator that the derived class provides. More...

Inheritance diagram for arene::base::full_ordering_operators_from_less_than< Derived, Other >:
Inheritance graph

Friends

ARENE_NODISCARD friend constexpr auto operator== (Derived const &lhs, Other const &rhs) noexcept -> bool
 Greater-than-or-equal comparison operator for instances of LhsType and RhsType.
 

Detailed Description

template<typename Derived, typename Other = Derived>
class arene::base::full_ordering_operators_from_less_than< Derived, Other >

Helper class that can be inherited from by a class to define the >, <=, >=, == and != operators in terms of a < operator that the derived class provides.

The derived class is required to provide:

  • operator<(const Derived&, const Other&)
  • operator<(const Other&, const Derived&)

This class defines the following operators in terms of those:

  • operator>(const Derived&, const Other&)
  • operator<=(const Derived&, const Other&)
  • operator>=(const Derived&, const Other&)
  • operator==(const Derived&, const Other&)
  • operator!=(const Derived&, const Other&)
  • operator>(const Other&, const Derived&)
  • operator<=(const Other&, const Derived&)
  • operator>=(const Other&, const Derived&)
  • operator==(const Other&, const Derived&)
  • operator!=(const Other&, const Derived&)

For example:

const char*> {
...
// Only need to define less-than. Others defined in terms of this.
friend bool operator<(const MyString& a, const char* b) noexcept;
friend bool operator<(const char* a, const MyString& b) noexcept;
};
Helper class that can be inherited from by a class to define the >, <=, >=, == and !...
Definition operators.hpp:674

Friends And Related Symbol Documentation

◆ operator==

template<typename Derived, typename Other = Derived>
ARENE_NODISCARD friend constexpr auto operator== ( Derived const & lhs,
Other const & rhs ) -> bool
friend

Greater-than-or-equal comparison operator for instances of LhsType and RhsType.

Parameters
lhsThe first object being compared
rhsThe second object being compared
Returns
True if lhs is greater than or equal to rhs, false otherwise.

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