I need to do custom deleter for shared_ptr. I know that this can be done in a similar way:
std::shared_ptr<SDL_Surface>(Surf_return_f(), MyDeleter);
But I would like to make them in the style of my custom deleter for unique_ptr:
struct SDL_Surface_Deleter {
void operator()(SDL_Surface* surface) {
SDL_FreeSurface(surface);
}
};
using SDL_Surface_ptr = std::unique_ptr<SDL_Surface, SDL_Surface_Deleter>;
Is there any way to do this?
Aucun commentaire:
Enregistrer un commentaire