//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// shared_ptr
// template<class Y> void reset(Y* p);
#include<memory>#include<cassert>structB{staticintcount;B(){++count;}B(constB&){++count;}virtual~B(){--count;}};intB::count=0;structA:publicB{staticintcount;A(){++count;}A(constA&){++count;}~A(){--count;}};intA::count=0;intmain(){{std::shared_ptr<B>p(newB);A*ptr=newA;p.reset(ptr);assert(A::count==1);assert(B::count==1);assert(p.use_count()==1);assert(p.get()==ptr);}assert(A::count==0);{std::shared_ptr<B>p;A*ptr=newA;p.reset(ptr);assert(A::count==1);assert(B::count==1);assert(p.use_count()==1);assert(p.get()==ptr);}assert(A::count==0);}