//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include<memory>#include<cassert>// unique_ptr(pointer) ctor shouldn't require complete type
structA;classDeleter{intstate_;Deleter(Deleter&);Deleter&operator=(Deleter&);public:Deleter():state_(5){}intstate()const{returnstate_;}voidoperator()(A*p);};voidcheck(inti);template<classD=std::default_delete<A>>structB{std::unique_ptr<A,D>a_;explicitB(A*);~B();A*get()const{returna_.get();}D&get_deleter(){returna_.get_deleter();}};A*get();intmain(){{A*p=get();check(1);B<>s(p);assert(s.get()==p);}check(0);{A*p=get();check(1);B<Deleter>s(p);assert(s.get()==p);assert(s.get_deleter().state()==5);}check(0);}structA{staticintcount;A(){++count;}A(constA&){++count;}~A(){--count;}};intA::count=0;A*get(){returnnewA;}voidDeleter::operator()(A*p){deletep;}voidcheck(inti){assert(A::count==i);}template<classD>B<D>::B(A*a):a_(a){}template<classD>B<D>::~B(){}