Advertisement
ulfben

unique_ptr with custom destruction

Sep 26th, 2016
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  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>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement