Introduces two key concepts: the use of a generic requirements based approach to simplify and adapt the use of the counted body pattern and the ability to dynamically and non-intrusively add capabilities to fixed types using the runtime mixin pattern.
Using several features of the language, this article presents a framework for resource allocation which is temporally deterministic, provides for callback, provides memory pools, and can provide for deadlock prevention.
Memory management is scary. It should be: A lot can go wrong--often very wrong. But a moderately experienced C or C++ programmer can learn and understand memory hazards completely.
Andrei Alexandrescu navigates through the sometimes treacherous waters of using smart pointers, which imitate built-in pointers in syntax and semantics but perform a host of additional tasks that built-in pointers can't.
Andrei Alexandrescu discusses smart pointers, from their simplest aspects to their most complex ones and from the most obvious errors in implementing them to the subtlest ones--some of which also happen to be the most gruesome.
Explains why a class that provides its own class-specific operator new(), or operator new[](), should also provide corresponding class-specific versions of plain new, in-place new, and nothrow new.