[concept.comparisoncommontype]

# 18 Concepts library [[concepts]](./#concepts)

## 18.5 Comparison concepts [[concepts.compare]](concepts.compare#concept.comparisoncommontype)

### 18.5.3 Comparison common types [concept.comparisoncommontype]

[ð](#itemdecl:1)

`template<class T, class U, class C = common_reference_t<const T&, const U&>>
  concept [comparison-common-type-with-impl](#concept:comparison-common-type-with-impl "18.5.3 Comparison common types [concept.comparisoncommontype]") =   // exposition only
    [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<common_reference_t<const T&, const U&>,
            common_reference_t<const U&, const T&>> &&
    requires {
      requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<const T&, const C&> || [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<T, const C&>;
      requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<const U&, const C&> || [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<U, const C&>;
    };

template<class T, class U>
  concept [comparison-common-type-with](#concept:comparison-common-type-with "18.5.3 Comparison common types [concept.comparisoncommontype]") =   // exposition only
    [comparison-common-type-with-impl](#concept:comparison-common-type-with-impl "18.5.3 Comparison common types [concept.comparisoncommontype]")<remove_cvref_t<T>, remove_cvref_t<U>>;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L1007)

Let C be common_reference_t<const T&, const U&>[.](#1.sentence-1)

Let t1 and t2 be equality-preserving expressions
that are lvalues of type remove_cvref_t<T>, and
let u1 and u2 be equality-preserving expressions
that are lvalues of type remove_cvref_t<U>[.](#1.sentence-2)

T and U model[*comparison-common-type-with*](#concept:comparison-common-type-with "18.5.3 Comparison common types [concept.comparisoncommontype]")<T, U> only if

- [(1.1)](#1.1)

*CONVERT_TO_LVALUE*<C>(t1) equals*CONVERT_TO_LVALUE*<C>(t2) if and only if t1 equals t2, and

- [(1.2)](#1.2)

*CONVERT_TO_LVALUE*<C>(u1) equals*CONVERT_TO_LVALUE*<C>(u2) if and only if u1 equals u2
