fork download
  1. #include <iostream>
  2. #include <memory>
  3.  
  4. int main() {
  5. struct my_type
  6. {
  7. void poke() { std::cout << "poke\n"; }
  8. };
  9. typedef my_type* my_type_ptr;
  10.  
  11. struct my_deleter
  12. {
  13. typedef my_type_ptr pointer;
  14. void operator()(my_type_ptr p) { delete p; }
  15. };
  16.  
  17. typedef std::unique_ptr<my_type_ptr, my_deleter> my_unique_ptr;
  18.  
  19. my_unique_ptr x(new my_type);
  20. x->poke();
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
poke