fork(1) download
  1. #include <iostream>
  2. #include <memory>
  3. #include <functional>
  4.  
  5. template<typename T>
  6. using TypeErasedUPtr = std::unique_ptr<T, std::function<void(T*)>>;
  7.  
  8. int main()
  9. {
  10. TypeErasedUPtr<int> test{new int(5), [](int* x){ delete x; }};
  11. return 0;
  12. }
Success #stdin #stdout 0s 3224KB
stdin
Standard input is empty
stdout
Standard output is empty