As we mentioned in the previous section, because our Array class defines a destructor, according to the rule of five, it should also define other special member functions. In this section, you'll learn about an idiom that lets us do this without boilerplate, while also adding strong exception safety as a bonus.
If you're not familiar with the exception safety levels, here's a quick recap of the levels your functions and types can offer:
- No guarantee: This is the most basic level. No guarantees are made about the state of your object after an exception is thrown while it's being used.
- Basic exception safety: Side effects are possible, but your object won't leak any resources, will be in a valid state, and will contain valid data (not necessarily the same as before the operation). Your types should always offer at least this level.
- Strong exception safety: No side effects will happen. The object's state...