SHARE
TWEET

unique_ptr with custom destruction

ulfben Sep 26th, 2016 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <memory>
  2. namespace internal {
  3.     struct TextureDeleter {
  4.         void operator()(SDL_Texture* resource) {
  5.             if(resource != nullptr) {
  6.                 SDL_DestroyTexture(resource);
  7.             }
  8.         }
  9.     }
  10. }
  11.  
  12. using Texture = std::unique_ptr<SDL_Texture, internal::TextureDeleter>;
RAW Paste Data
Top