Multiple ChoiceBeginner 45s
variant valueless_by_exception
When can a `std::variant` become `valueless_by_exception`, and why does it matter?
Options
- 1Never; the standard guarantees a variant always holds one of its alternatives, even mid-switch.
- 2If an exception is thrown while switching alternatives, the variant holds no value; you must handle it before visiting.
- 3Only when its active alternative is a type with a deleted or throwing destructor during cleanup.
- 4Only when it is default-constructed and the first alternative has no usable default constructor.
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.