Namespace Subspace :: sus :: cmp

Utilities for comparing and ordering values.

This namespace contains various tools for comparing and ordering values. In summary:

  • Eq is a concept that allows you to require partial equality between values. It requires the == and != operators to be available, which is typically implemented just by ==. Note that C++ does not model total vs partial equality so there's no differentiation for a PartialEq concept.
  • Ord, StrongOrd and PartialOrd are concept that allows you to require total, unique, and partial orderings between values, respectively. Implementing them requires the <=> operator to be defined, and makes the the <, <=, >, and >= operators accessible. Ordering is a concept that matches any of the standard library ordering types which are returned from the <=> operator: std::weak_ordering, std::strong_ordering, or std::partial_ordering.
  • Reverse is a struct that allows you to easily reverse an ordering.
  • max and min are functions that build off of Ord and allow you to find the maximum or minimum of two values. There are other similar functions that make use of Ord as well.

For more details, see the respective documentation of each item in the list.

Classes

  • A helper struct for reverse ordering.

Functions

  • Restrict a value to a certain interval.

  • Compares and returns the maximum of two values.

  • Compares and returns the maximum of two values with respect to the specified comparison function.

  • Returns the element that gives the maximum value from the specified function.

  • Compares and returns the minimum of two values.

  • Compares and returns the minimum of two values with respect to the specified comparison function.

  • Returns the element that gives the minimum value from the specified function.

Operators

  • Returns the reverse ordering of the values in two Reserve objects.

  • Compares the values in two Reserve objects.

Concepts

  • Concept for types that can be compared for equality with the == and != operators. There is no guarantee of a full equivalence relation, and a partial equivalence is possible, which allows for values that compare not-equal to themselves (such as NaN).

  • Determines if the types Lhs and Rhs have total ordering (aka std::weak_ordering), and that this is the strongest ordering that exists between the types.

  • Determines if the types Lhs and Rhs have a partial ordering (aka std::partial_ordering), and that this is the strongest ordering that exists between the types.

  • Concept for types that have a unique total ordering (aka std::strong_ordering).

  • Concept for types that form a total ordering (aka std::weak_ordering).

  • Concept that combines all ordering types together.

  • Concept for types that form a partial ordering (aka std::partial_ordering).

  • Concept for types that form a unique total order (aka std::strong_ordering). Objects that sort the same for ordering must also compare as equal.