Home | History | Annotate | Download | only in unique.ptr.dltr.dflt
      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 // default_delete
     13 
     14 #include <memory>
     15 #include <cassert>
     16 
     17 struct A
     18 {
     19     static int count;
     20     A() {++count;}
     21     A(const A&) {++count;}
     22     ~A() {--count;}
     23 };
     24 
     25 int A::count = 0;
     26 
     27 int main()
     28 {
     29     std::default_delete<A> d;
     30     A* p = new A;
     31     assert(A::count == 1);
     32     d(p);
     33     assert(A::count == 0);
     34 }
     35