RAII Design Guidelines

05 Jan 2023

[ c++  design  interface  ]

RAII Solves

RAII not intended to solve

Example - std::unique_ptr

Design guidelines

Default acquisition?

“empty state”?

Adopting a resource allowed?

Copyable?

Movable?

Access underlying representation?

Hide underlying representation?

Dependent resources?

Release the resource?

Reference