function template
<memory>

std::relational operators (unique_ptr)

(1)
template <class T1, class D1, class T2, class D2>  bool operator== (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator== (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator== (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
(2)
template <class T1, class D1, class T2, class D2>  bool operator!= (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator!= (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator!= (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
(3)
template <class T1, class D1, class T2, class D2>  bool operator<  (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator<  (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator<  (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
(4)
template <class T1, class D1, class T2, class D2>  bool operator<= (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator<= (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator<= (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
(5)
template <class T1, class D1, class T2, class D2>  bool operator>  (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator>  (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator>  (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
(6)
template <class T1, class D1, class T2, class D2>  bool operator>= (const unique_ptr<T1,D1>& lhs, const unique_ptr<T2,D2>& rhs);template <class T, class D> bool operator>= (const unique_ptr<T,D>& lhs, nullptr_t) noexcept;template <class T, class D> bool operator>= (nullptr_t, const unique_ptr<T,D>& rhs) noexcept;
Relational operators ==, !=, <, <=, >, >=
Performs the appropriate relational comparison operation between the unique_ptr objects lhs and rhs, or between a unique_ptr and a nullptr.

Two unique_ptr compare equal (==) if their stored pointers compare equal, and not equal (!=) otherwise.

The other operators (<, <=, > and >=) order pointers according to the strict weak order defined by less applied on their respective stored pointers.

The stored deleter is ignored in the comparison.

Parameters

lhs, rhs
unique_ptr objects (to the left- and right-hand side of the operator, respectively).

Return Value

true if the condition holds, and false otherwise.

See also