All challenges
Multiple ChoiceIntermediate 45s

Accessing the wrong alternative in std::variant

What happens if you call std::get<int>(v) on a std::variant that currently holds a std::string?
Options
  1. 1It throws std::bad_variant_access
  2. 2It returns a default-constructed int
  3. 3It is undefined behavior
  4. 4It converts the string to an int

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