//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // shared_ptr // template // bool operator==(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator==(nullptr_t, const unique_ptr& y) noexcept; // template // bool operator!=(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator!=(nullptr_t, const unique_ptr& y) noexcept; // template // bool operator<(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator<(nullptr_t, const unique_ptr& y) noexcept; // template // bool operator<=(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator<=(nullptr_t, const unique_ptr& y) noexcept; // template // bool operator>(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator>(nullptr_t, const unique_ptr& y) noexcept; // template // bool operator>=(const unique_ptr& x, nullptr_t) noexcept; // template // bool operator>=(nullptr_t, const unique_ptr& y) noexcept; #include #include void do_nothing(int*) {} int main() { int* ptr1(new int); int* ptr2(new int); const std::unique_ptr p1(new int(1)); assert(!(p1 == nullptr)); assert(!(nullptr == p1)); assert(!(p1 < nullptr)); assert( (nullptr < p1)); assert(!(p1 <= nullptr)); assert( (nullptr <= p1)); assert( (p1 > nullptr)); assert(!(nullptr > p1)); assert( (p1 >= nullptr)); assert(!(nullptr >= p1)); const std::unique_ptr p2; assert( (p2 == nullptr)); assert( (nullptr == p2)); assert(!(p2 < nullptr)); assert(!(nullptr < p2)); assert( (p2 <= nullptr)); assert( (nullptr <= p2)); assert(!(p2 > nullptr)); assert(!(nullptr > p2)); assert( (p2 >= nullptr)); assert( (nullptr >= p2)); }