What are the different categories of exception safety guarantees (no-throw, strong, basic)?
Last updated
No-throw: the operation never fails and is marked
noexcept. It is required of destructors,swapand moves.Strong (commit-or-rollback): on throw, state is exactly as before the call. It is typically implemented with copy-and-swap (work on a copy, then a
noexceptswap).Basic: on throw, nothing leaks and invariants hold, but the state is valid yet unspecified. This is the minimum acceptable level (no guarantee is broken code).