A: Yes, except possibly encapsulated inside the implementations of low-level data structures.
The more general question on SO was:
About the usage of new and delete, and Stroustrup's advice
About the usage of
newanddelete, and Stroustrup's advice...He says something like (but not exactly, this is from my notes of his book):
A rule of thumb is that,
newbelongs in constructors and similar operations,deletebelongs in destructors. In addition,newis often used in arguments to resource handles. Otherwise avoid usingnewanddelete, use resource handles (smart pointers) instead.I was wondering if the more experienced folks with C++11 have really applied this or not.
My impression of this was, wow this seems like a really cool rule to follow. But then I got suspicious, as for any general rule. At the end of the day you will end up using
newanddeletewherever necessary. But maybe this rule is a good guideline I don't know.

Add a Comment
Comments are closed.