Udostępnij przez


<optional>, operatory

operator==

Sprawdza, czy optional obiekt po lewej stronie operatora jest równy optional obiektowi po prawej stronie.

template <class T, class U> constexpr bool operator==(const optional<T>& left, const optional<U>& right);
template <class T> constexpr bool operator==(const optional<T>& left, nullopt_t right) noexcept;
template <class T> constexpr bool operator==(nullopt_t left, const optional<T>& right) noexcept;
template <class T, class U> constexpr bool operator==(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator==(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

operator!=

Sprawdza, czy optional obiekt po lewej stronie operatora nie jest równy optional obiektowi po prawej stronie.

template <class T, class U> constexpr bool operator!=(const optional<T>&, const optional<U>&);
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator!=(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

Uwagi

Ta funkcja szablonu zwraca wartość !(left == right).

operator<

Sprawdza, czy optional obiekt po lewej stronie operatora jest mniejszy niż optional obiekt po prawej stronie.

template <class T, class U> constexpr bool operator<(const optional<T>&, const optional<U>&);
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
template <class T, class U> constexpr bool operator<(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator<(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

Wartość zwracana

true jeśli lista po lewej stronie operatora jest mniejsza niż, ale nie równa się liście po prawej stronie operatora; w przeciwnym razie false.

operator<=

Sprawdza, czy optional obiekt po lewej stronie operatora jest mniejszy lub równy optional obiektowi po prawej stronie.

template <class T, class U> constexpr bool operator<=(const optional<T>&, const optional<U>&);
template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator<=(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

Wartość zwracana

true jeśli lista po lewej stronie operatora jest mniejsza lub równa liście po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Ta funkcja szablonu zwraca wartość !(right < left).

operator>

Sprawdza, czy optional obiekt po lewej stronie operatora jest większy niż optional obiekt po prawej stronie.

template <class T, class U> constexpr bool operator>(const optional<T>&, const optional<U>&);
template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
template <class T, class U> constexpr bool operator>(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator>(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

Wartość zwracana

true jeśli lista po lewej stronie operatora jest większa niż lista po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Ta funkcja szablonu zwraca wartość right < left.

operator>=

Sprawdza, czy optional obiekt po lewej stronie operatora jest większy lub równy optional obiektowi po prawej stronie.

template <class T, class U> constexpr bool operator>=(const optional<T>&, const optional<U>&);
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
template <class T, class U> constexpr bool operator>=(const U&, const optional<T>&);

Parametry

Lewy
Obiekt typu optional, nullopt_tlub T.

Prawy
Obiekt typu optional, nullopt_tlub T.

Wartość zwracana

true jeśli po optional lewej stronie operatora jest większy lub równy optional prawej stronie operatora; w przeciwnym razie false.

Uwagi

Funkcja szablonu zwraca !(left < right)wartość .