Closed Lastique closed 2 years ago
I'm not quite sure this belongs here, even though we do have null_deleter
. Which probably doesn't belong here either.
Should I revert?
Utility seems a better place for fclose_deleter
, but having null_deleter
here and fclose_deleter
there wouldn't be particularly consistent. So maybe not.
You have to check p
for NULL
though. unique_ptr
skips the deleter on NULL
, but shared_ptr
does not. And you should probably have a test where fopen
returns NULL
. Maybe test with boost::shared_ptr
too.
You have to check
p
forNULL
though.unique_ptr
skips the deleter onNULL
, butshared_ptr
does not.
Hmm, I thought shared_ptr
also didn't call the deleter on NULL
. Will fix, thanks.
fclose_deleter
can be used as a deleter function object forstd::FILE
pointers returned bystd::fopen
.