by tdicola · 12y ago · 0 comments
What if you want to add event handlers for window events, change the window title, or even (gasp) throw exceptions instead of constantly check return codes? Wrapping the resource in a class gives you a great place to add this functionality. Without the class you have a nice resource that won't leak but still feels like you're programming C.
In the end, I find it more readable to see unique_ptr and shared_ptr than raw resources. They describe more than just resource management.