Add note about pointerlike indirections, and remove incorrect destructor note

Closes #2183
Closes #2188
This commit is contained in:
Herb Sutter
2024-04-14 14:34:20 -04:00
parent 4f723b0fff
commit 6c68bf8f34

View File

@@ -5096,10 +5096,6 @@ There are two general categories of classes that need a user-defined destructor:
The default destructor does it better, more efficiently, and can't get it wrong. The default destructor does it better, more efficiently, and can't get it wrong.
##### Note
If the default destructor is needed, but its generation has been suppressed (e.g., by defining a move constructor), use `=default`.
##### Enforcement ##### Enforcement
Look for likely "implicit resources", such as pointers and references. Look for classes with destructors even though all their data members have destructors. Look for likely "implicit resources", such as pointers and references. Look for classes with destructors even though all their data members have destructors.
@@ -12682,6 +12678,10 @@ wrong results, or memory corruption.
##### Note ##### Note
By pointer here we mean any indirection to an object, including equivalently an iterator or view.
##### Note
This rule is an obvious and well-known language rule, but can be hard to follow. This rule is an obvious and well-known language rule, but can be hard to follow.
It takes good coding style, library support, and static analysis to eliminate violations without major overhead. It takes good coding style, library support, and static analysis to eliminate violations without major overhead.
This is a major part of the discussion of [C++'s model for type- and resource-safety](#Stroustrup15). This is a major part of the discussion of [C++'s model for type- and resource-safety](#Stroustrup15).