March 2025
Intermediate to advanced
442 pages
11h 16m
English
In Chapter 7, we examined various ways to overload the memory allocation operators, which are new, new[], delete, and delete[], in order to grasp the syntax involved in writing these operators as well as how they can be used in client code. We discussed how these operators interact with exceptions (even in the case of the nothrow versions) and saw why they should, in most cases, be written in groups of four or multiples thereof. For example, code that calls the nothrow version of operator new() to obtain some pointer, pV and later on calls delete p will quickly get in trouble if one overloads the nothrow version but not the “regular” one, as both might then end up not being compatible with one another.
What we ...
Read now
Unlock full access