Hacker News new | ask | show | jobs
by yoklov 4079 days ago
Well, you can avoid using desctructors, but then you can't use the majority of the STL, so what's the point? (This is basically what I do anyway)
1 comments

You don't have to tie resource lifetime to object lifetime, that's the mistake the SFML folks made.
Right, my point is that I typically don't really want to tie memory lifetime to object lifetime either. So the whole of RAII is not a great fit, outside of a couple edge cases.
RAII is about resources, not memory. If you don't want to tie memory lifetime to object lifetime then don't. That's the entire point of things like smart pointers.

That's exactly the issue SFML had. This idea that RAII implies tying resources directly to an objects lifetime. It doesn't.