1. In a lot of the code I work with the std::for_each+lambda version is much easier to read, it's just force of habit.
2. I called it "example" for a reason; pretend it is something for which there is not already an RAII wrapper.
3. It ensures that no code gets put between the invalidation of the pointer and the nullification of the pointer, also a force of habit.
But do I have the rough concept of RAII down? The RAII class is supposed to be used when there doesn't already exist an RAII wrapper for something that can be constructed and destructed. Am I even on the right track?
I guess. I think that in the best case though you would just modify the class/object itself to have a proper constructor/destructor. Maybe you could use for a custom setup/desetup for something though, but in that case I'd probably just make another class that did it in its constructor/desctructor instead.