1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <memory>
11 
12 // shared_ptr
13 
14 // template <class T>
15 //     bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
16 // template <class T>
17 //     bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;
18 // template <class T>
19 //     bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept;
20 // template <class T>
21 //     bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept;
22 // template <class T>
23 //     bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept;
24 // template <class T>
25 //     bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept;
26 // template <class T>
27 //     bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept;
28 // template <class T>
29 //     bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept;
30 // template <class T>
31 //     bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept;
32 // template <class T>
33 //     bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept;
34 // template <class T>
35 //     bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;
36 // template <class T>
37 //     bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;
38 
39 #include <memory>
40 #include <cassert>
41 
do_nothing(int *)42 void do_nothing(int*) {}
43 
main()44 int main()
45 {
46     const std::shared_ptr<int> p1(new int(1));
47     assert(!(p1 == nullptr));
48     assert(!(nullptr == p1));
49     assert(!(p1 < nullptr));
50     assert( (nullptr < p1));
51     assert(!(p1 <= nullptr));
52     assert( (nullptr <= p1));
53     assert( (p1 > nullptr));
54     assert(!(nullptr > p1));
55     assert( (p1 >= nullptr));
56     assert(!(nullptr >= p1));
57 
58     const std::shared_ptr<int> p2;
59     assert( (p2 == nullptr));
60     assert( (nullptr == p2));
61     assert(!(p2 < nullptr));
62     assert(!(nullptr < p2));
63     assert( (p2 <= nullptr));
64     assert( (nullptr <= p2));
65     assert(!(p2 > nullptr));
66     assert(!(nullptr > p2));
67     assert( (p2 >= nullptr));
68     assert( (nullptr >= p2));
69 }
70