All challenges
Multiple ChoiceBeginner 45s

optional reference workaround

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

Play this in a 3-minute battle