Search⌘ K

Dependent Names

Explore how dependent names in C++ templates—those relying on template parameters—are handled by the compiler. This lesson helps you understand the challenges in interpreting dependent names as types, non-types, or templates, and how to guide the compiler using keywords like typename and template to avoid errors during template instantiation.

Dependent Names

A dependent name is essentially a name that depends on a template parameter. A dependent name can be a type, a non-type, or a template-template parameter.

If you use a dependent name in a template declaration or template definition, the compiler has no idea, whether this name refers to a type, a non-type, or a template parameter. In this case, the compiler assumes that the dependent name refers to a ...