1
General / Re: Ping Tutorial Question
« on: August 26, 2017, 04:22:48 pm »For the state stack it's understandable to use heap allocation as it stores the states as pointer to base class - although modern C++ would prefer a smart pointer (aka RAII) which can be stored in a vector using std::move() and takes care of the new/delete problem. Members such as font and text have no need for heap allocation, and can be initialised via the constructor's initialiser list rather than using double initialisation (which is still true even if you do decide to use smart pointers). It seems unusual to write 'this' everywhere (to me at least), although it appears to be a preference thing - many people instead prefix members with m_ or _. If you can, check out the first SFML game development book, it has a great example of a state stack, and is probably the best of the bunch.
Apparently the guy used "this" a lot to just show the viewers what variables he was referencing. And that state pointer is a raw pointer so surely it's bad that It's not being deleted anywhere