Hacker Newsnew | past | comments | ask | show | jobs | submit | jmq's commentslogin

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);


Cool, thanks for the tip. I meant to offer an example for the general case.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: