//===----------------------------------------------------------------------===//
//
// 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 move ctor
// test move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include<memory>#include<cassert>#include"../../deleter.h"structA{staticintcount;A(){++count;}A(constA&){++count;}~A(){--count;}};intA::count=0;classNCDeleter{intstate_;NCDeleter(NCDeleter&);NCDeleter&operator=(NCDeleter&);public:NCDeleter():state_(5){}intstate()const{returnstate_;}voidset_state(ints){state_=s;}voidoperator()(A*p){delete[]p;}};std::unique_ptr<A[]>source1(){returnstd::unique_ptr<A[]>(newA[3]);}voidsink1(std::unique_ptr<A[]>p){}std::unique_ptr<A[],Deleter<A[]>>source2(){returnstd::unique_ptr<A[],Deleter<A[]>>(newA[3]);}voidsink2(std::unique_ptr<A[],Deleter<A[]>>p){}std::unique_ptr<A[],NCDeleter&>source3(){staticNCDeleterd;returnstd::unique_ptr<A[],NCDeleter&>(newA[3],d);}voidsink3(std::unique_ptr<A[],NCDeleter&>p){}intmain(){sink1(source1());sink2(source2());sink3(source3());assert(A::count==0);}