1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 // template<class Y> weak_ptr& operator=(const weak_ptr<Y>& r);
17 #include <type_traits>
25 B(const B&) {++count;}
26 virtual ~B() {--count;}
37 A(const A&) {++count;}
46 const std::shared_ptr<A> ps(new A);
47 const std::weak_ptr<A> pA(ps);
51 assert(B::count == 1);
52 assert(A::count == 1);
53 assert(pB.use_count() == 1);
54 assert(pA.use_count() == 1);
56 assert(pA.use_count() == 1);
57 assert(B::count == 1);
58 assert(A::count == 1);
60 assert(B::count == 0);
61 assert(A::count == 0);