Exception Guarantee Specifics
The following represent exception guaratee specifics, subject to the component exception-requirements.
- No resources are leaked in the face of exceptions. In particular, this means:
- By the time a container's destructor completes:
- It has returned all memory it has allocated to the appropriate deallocation function.
- The destructor has been called for all objects constructed by the container.
- Algorithms destroy all temporary objects and deallocate all temporary memory even if the algorithm does not complete due to an exception.
- Algorithms which construct objects either complete successfully or destroy any objects they have constructed at the time of the exception.
- Algorithms which destruct objects always succeed.
- Containers continue to fulfill all of their requirements, even after an exception occurs during a mutating function. For example, they will never give an inaccurate report of its size, or fail to meet performance requirements because of some thrown exception.
- The strong guarantee: If an operation on a container fails due to an exception, then, semantically, the operation is a no-op applied to the container.
- The operation cannot throw an exception.
(The phrasing of the above is based on [abrahams97exception].)