Multiple ChoiceBeginner 45s
optional reference workaround
Since std::optional<T&> is not allowed, what is a common workaround to hold an optional reference?
Options
- 1Use std::optional<T*> and dereference without checks
- 2Use std::optional<T> and copy the object
- 3Use std::variant<T&>
- 4Use std::optional<std::reference_wrapper<T>>
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.