You can reduce verbosity of the code by passing destructor function directly to unique_ptr constructor: std::unique_ptr<Image, void (*)(Image *)>(image, deallocate_image);
You can reduce verbosity of the code by passing destructor function directly to unique_ptr constructor: std::unique_ptr<Image, void (*)(Image *)>(image, deallocate_image);