Multiple ChoiceIntermediate 45s
expected has_value check
In std::expected<int, std::error_code>, how do you check whether a value or error is held?
Options
- 1e.ok(), the dedicated member testing for a held value
- 2e.is_error() only, since has_value() is not provided
- 3You cannot check at all, it throws on the wrong side
- 4e.has_value() or the boolean conversion operator
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.