Home | History | Annotate | Download | only in unique.ptr.runtime.observers
      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 // unique_ptr
     13 
     14 // test get_deleter()
     15 
     16 #include <memory>
     17 #include <cassert>
     18 
     19 struct Deleter
     20 {
     21     void operator()(void*) {}
     22 
     23     int test() {return 5;}
     24     int test() const {return 6;}
     25 };
     26 
     27 int main()
     28 {
     29     {
     30     std::unique_ptr<int[], Deleter> p;
     31     assert(p.get_deleter().test() == 5);
     32     }
     33     {
     34     const std::unique_ptr<int[], Deleter> p;
     35     assert(p.get_deleter().test() == 6);
     36     }
     37 }
     38