|
|
|
|
|
by Too
3168 days ago
|
|
std::unique_ptr has a widely unknown second template argument called deleter. It is designed exactly for this purpose. You just do roughly like this(written from a phone): typedef fdwrapper = unique_ptr<int, close>;
fdwrapper fdhandle(open(filename));
|
|