All challenges
Multiple ChoiceIntermediate 45s

vector bool proxy iterator pitfalls

Why is std::vector<bool>'s operator[] return type problematic in generic code?
Options
  1. 1It returns a corrupted bit value, masking the wrong bit when packing bools
  2. 2It cannot be iterated at all, failing the forward iterator requirements
  3. 3It returns a proxy reference, not bool&, breaking code needing a real reference
  4. 4It returns a dangling pointer into a temporary bitfield destroyed on return

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