News for hackers. Stuff that matters.
Re:C++14 and SDL2: Managing Resources by humanrebar on Friday April 18, 2014 @07:55PM (#7611926)
> The wasteful thing about this is that you have to store the deleter (free() in this case) right next to your void* for every pointer you manage

In the examples given, the function pointers in question would be stored on the stack. How many windows should an application be juggling at once that an extra 8 bytes per window is a concern? This seems like a premature optimization to me.

If you're individually rendering blades of grass in a goat simulator, sure. But by the time you're dealing with arbitrary-length application-defined strings (like window names), an extra pointer isn't a big deal.

For me to believe that a small_ptr was worthwhile here, I would have to see some benchmarks, which is how good optimization happens anyway.

There are no comments on this comment yet.