Each carrier is compared where its contents are and against the states it can be in These are declared alongside the carrier they serve rather than in one header so reach them by including the carrier s own An empty or failed operand equals nothing and orders before every value so a comparison answers rather than throwing where a contained type has no such operator the comparison is simply not viable not ill formed operator operator operator< operator< operator> operator> operator< > swap template <typename Ts typename Tx> constexpr auto operator choice<Ts > const &lh choice<Tx > const &rh > bool 1 constexpr auto operator copack<Ts > const &lh copack<Tx > const &rh > bool 2 template <typename T typename Err typename T2> constexpr auto operator expected<T Err> const &x T2 const &v > bool 3 template <typename T typename U> constexpr auto operator just<T> const &lh just<U> const &rh > bool 4 constexpr auto operator just<T> const &lh U const &rh > bool 5 template <class T class U> constexpr auto operator optional<T> const &x optional<U> const &y > bool 6 template <class T> constexpr auto operator optional<T> const &x std nullopt_t > bool 7 template <class T class U> constexpr auto operator optional<T> const &x U const &v > bool 8 constexpr auto operator T const &v optional<U> const &x > bool 9 Compares two choices equal when they hold the same alternative type with equal values The alternative sets need not match an alternative the other side cannot hold compares unequal without being compared return Whether the active alternatives are the same type with equal values lh choice < Ts > const & Left choice rh choice < Tx > const & Right choice Compares two copacks equal when they hold the same alternative type with equal values The copacks need not have the same alternative sets an alternative the other side cannot hold compares unequal without being compared and need not even be equality comparable return Whether the active alternatives are the same type with equal values lh copack < Ts > const & Left copack rh copack < Tx > const & Right copack Compares the payloads of two just values Compares the payload with a value Compares two optionals two empty optionals are equal Whether the optional is empty Compares an optional against a value an empty optional equals nothing Compares a value against an optional an empty optional equals nothing template <typename Ts typename Tx> constexpr auto operator choice<Ts > const &lh choice<Tx > const &rh > bool 1 template <class T class U> constexpr auto operator optional<T> const &x optional<U> const &y > bool 2 constexpr auto operator optional<T> const &x U const &v > bool 3 constexpr auto operator T const &v optional<U> const &x > bool 4 The negation of for two choices return Whether the choices differ in alternative type or value lh choice < Ts > const & Left choice rh choice < Tx > const & Right choice The negation of for two optionals The negation of against a value The negation of against a value template <class T class U> constexpr auto operator< optional<T> const &x optional<U> const &y > bool 1 constexpr auto operator< optional<T> const &x U const &v > bool 2 constexpr auto operator< T const &v optional<U> const &x > bool 3 Orders two optionals the empty state before every value Orders an optional against a value an empty optional before it Orders an optional against a value an empty optional before it template <class T class U> constexpr auto operator< optional<T> const &x optional<U> const &y > bool 1 constexpr auto operator< optional<T> const &x U const &v > bool 2 constexpr auto operator< T const &v optional<U> const &x > bool 3 Orders two optionals the empty state before every value Orders an optional against a value an empty optional before it Orders an optional against a value an empty optional before it template <class T class U> constexpr auto operator> optional<T> const &x optional<U> const &y > bool 1 constexpr auto operator> optional<T> const &x U const &v > bool 2 constexpr auto operator> T const &v optional<U> const &x > bool 3 Orders two optionals the empty state before every value Orders an optional against a value an empty optional before it Orders an optional against a value an empty optional before it template <class T class U> constexpr auto operator> optional<T> const &x optional<U> const &y > bool 1 constexpr auto operator> optional<T> const &x U const &v > bool 2 constexpr auto operator> T const &v optional<U> const &x > bool 3 Orders two optionals the empty state before every value Orders an optional against a value an empty optional before it Orders an optional against a value an empty optional before it template <class T std three_way_comparable_with<T> U> auto operator< > optional<T> const &x optional<U> const &y > std compare_three_way_result_t<T U> 1 template <class T> constexpr auto operator< > optional<T> const &x std nullopt_t > std strong_ordering 2 template <class T class U> auto operator< > optional<T> const &x U const &v > std compare_three_way_result_t<T U> 3 Orders two optionals the empty state before every value Orders the optional against the empty state which precedes every value Orders an optional against a value an empty optional before it template <class T> constexpr auto swap optional<T> &x optional<T> &y > void 1 Swaps two optionals