All challenges
Multiple ChoiceIntermediate 45s

Strong guarantee via copy-and-swap

The copy-and-swap idiom provides which guarantee and how?
Options
  1. 1Basic: it catches any exception thrown during the swap and retries the operation until it succeeds.
  2. 2Nothrow: swap is guaranteed not to throw, and no allocation occurs because the value is built in place.
  3. 3Strong: build a fully-constructed copy/new value, then swap with the target using nothrow operations.
  4. 4None: it merely reduces the strong exception guarantee down to the weaker basic guarantee on failure.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle