Resource Acquisition Is Initialization

a.k.a.

  • Scope Based Memory Management(SBRM)
  • Constructor Acquires, Destructor release(CADRE)
  • Pointer to Implementation(PIMPL)

Example

No-RAII:

RAII:

Smart Point

Unique Pointer

Shared Pointer

Weak Pointer