An assert statement checks a condition and immediately aborts execution when the condition is false. It enforces a function’s precondition at the point where the function is called. section 6.3.2
Protecting a circular buffer
A CircularBuffer.remove() method asserts that the buffer is not empty before removing a value. Calling remove() on an empty buffer therefore ends execution with an assertion failure instead of corrupting head, tail, or count state. An application may raise an exception instead when the caller should handle invalid use. section 6.3.2














