fex*_*fex 6 c++ sdl shared-ptr
我想知道如何将SDL_Surface*与shared_ptr连接?在删除之前我
需要打电话.如何在shared_ptr中"修改删除过程"?SDL_FreeSurface(SDL_Surface*)SDL_Surface
Ben*_*ley 13
只需将SDL_FreeSurface传递给构造函数:
std::shared_ptr<SDL_Surface> shared_surf(SDL_LoadBMP("foo.bmp"), SDL_FreeSurface);
Run Code Online (Sandbox Code Playgroud)
请确保您不使用SDL_SetVideoMode或返回的指针执行此操作SDL_GetVideoSurface.