Multiple ChoiceIntermediate 45s
Two-phase name lookup
In C++ templates, dependent names must often be prefixed with `typename` or `template`. Why?
Options
- 1Because typename is a reserved keyword that must be written before every identifier appearing inside a template.
- 2Because the compiler parses non-dependent names at definition time and cannot know whether a dependent qualified name is a type without the keyword.
- 3Because it prevents one-definition-rule violations between translation units that instantiate the same template.
- 4Because the keyword is needed to force the instantiation of the dependent name at the exact point where it is written.
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.