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 // template <class X> class auto_ptr; 13 14 // auto_ptr(auto_ptr& a) throw(); 15 16 // REQUIRES: c++98 || c++03 || c++11 || c++14 17 18 #include <memory> 19 #include <cassert> 20 21 #include "../A.h" 22 23 void test()24test() 25 { 26 { 27 A* p = new A(1); 28 std::auto_ptr<A> ap1(p); 29 std::auto_ptr<A> ap2(ap1); 30 assert(ap1.get() == 0); 31 assert(ap2.get() == p); 32 assert(A::count == 1); 33 } 34 assert(A::count == 0); 35 } 36 main()37int main() 38 { 39 test(); 40 } 41