Relational operators

| Home | Libraries | People | FAQ | More

#### Relational operators

###### Description

The TR1 Tuple provides the standard boolean relational operators.

###### Specification

Notation

`T1 ... TN`, `U1 ... UN`

  Tuple element types

`P1 ... PN`

  Parameter types

`Ti`, `Ui`

  The type of the `i`th element of a tuple

`Pi`

  The type of the `i`th parameter

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator==(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(lhs) == `get`<i>(rhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns `true` if and only if ``get`<i>(lhs) == `get`<i>(rhs)` for all `i`. For any 2 zero length tuples `e` and `f`, `e == f` returns `true`.

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator<(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(lhs) < `get`<i>(rhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns the lexicographical comparison of between `lhs` and `rhs`.

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator!=(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(lhs) == `get`<i>(rhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns `!(lhs == rhs)`.

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator<=(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(rhs) < `get`<i>(lhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns `!(rhs < lhs)`

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator>(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(rhs) < `get`<i>(lhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns `rhs < lhs`.

    template<typename T1, typename T2, ..., typename TN,
             typename U1, typename U2, ..., typename UN>
    bool operator>=(
        const tuple<T1, T2, ..., TN>& lhs,
        const tuple<U1, U2, ..., UN>& rhs);

Requirements: For all `i`, `1 <= i < N`, ``get`<i>(lhs) < `get`<i>(rhs)` is a valid expression returning a type that is convertible to `bool`.

Semantics: Returns `!(lhs < rhs)`.