1

I'm managing a vector of unique_ptrs to some SDL_Textures. When I quit the program, do I have to call SDL_DestroyTexture on all remaining textures in the vector, or does the destructor called by the deconstruction of unique_ptr take care of that?

Example code:

void foo(SDL_Renderer* renderer, const char* filePath) {
    // assume SDL is already initialized
    auto ptr = std::unique_ptr<SDL_Texture>(IMG_LoadTexture(renderer, filePath));
}

Is the SDL_Texture that was created properly destroyed after this function finishes?

I looked around in the source code a little bit, but wasn't able to find my way through to the actual definition of SDL_Texture.

L. Kue
  • 473
  • 5
  • 19

0 Answers0