I have the idea to do this:
namespace std {
template<>
class default_delete<IplImage> {
public:
void operator()(IplImage *ptr) const {
cvReleaseImage(&ptr);
}
};
};
typedef std::shared_ptr<IplImage> IplImageObj;
I didn't really found much information whether it is supported that I specialise default_delete
and whether shared_ptr
also uses default_delete
by default.
It works like intended with Clang 5.0.0.
So, is it supported?
What if the STL implementation has a different internal namespace? It wouldn't find my declaration then? But it should error about the declaration then.