unique_ptr is not really a good solution to this problem. Something like Boost.ScopeExit for short lived resources, or shared_ptr (which stores the deleter using type erasure, meaning you don't need to allow evidence of the deleter to to permeate through your codebase) is a lot easier on the eyes...
template <typename... Args> inline
std::shared_ptr<SDL_Window> CreateWindow (Args&&... args) {
return std::shared_ptr<SDL_Window> {SDL_CreateWindow(std::forward<Args>(args...)),
&SDL_DestroyWindow};
}
auto window = CreateWindow ("App Name", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
You know, or someone should write a good quality wrapper like you would just expect for any other language (Python, Ruby, whatever). Many here seem to be blasting C++ when nobody is doing any better without a similar level amount of work elsewhere.