Skip to content

cleanup of autoPtr, tmp classes

Should remove some slight inconsistencies between autoPtr and tmp, and reduce some coding verbosity.

  • For autoPtr, can use assignment from nullptr to effect a reset. Should also be allowed for tmp.
  • Reduce use of autoPtr empty() and valid() methods.

The autoPtr empty() method was introduced (Jan-2009) to reduce these types of constructs:

if (!myPtr.valid()) ...
if (myPtr.empty()) ...

But now there are some places with this type of thing:

if (!myPtr.empty()) ...

Since we now have an explicit bool operator, probably makes sense to use that instead:

if (myPtr) ...
if (!myPtr) ...
Edited by Mark OLESEN