#ifndef PTR_H #define PTR_H #include template class wrapped_ptr : public std::unique_ptr { public: using std::unique_ptr::unique_ptr; wrapped_ptr() : std::unique_ptr {{}, {}} { } inline operator Obj *() const { return this->get(); } template static auto create(Obj * (*factory)(Params...), void (*deleter)(Obj *), Args &&... args) { return wrapped_ptr {factory(std::forward(args)...), deleter}; } }; #endif