Multiple ChoiceIntermediate 45s
snapshot ctor noexcept move vector
std::vector uses move when reallocating only if T's move constructor is noexcept. Why?
Options
- 1If move could throw mid-reallocation the strong exception guarantee would be impossible, so it copies
- 2Moves are always cheaper because the source is left in a valid but unspecified state
- 3Copy constructors are deprecated for types that also provide a move constructor
- 4Noexcept on the move constructor improves only the generated code size, not behavior
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.