Quick Q: Where and why do I have to put the “template” and “typename” keywords?

Save to:
Instapaper Pocket Readability

Quick A: to help the compiler understand what the programmer wants.

Recently on SO:

Where and why do I have to put the “template” and “typename” keywords?

In order to parse a C++ program, the compiler needs to know whether certain names are types or not. The following example demonstrates that:

t * f;

How should this be parsed? For many languages a compiler doesn't need to know the meaning of a name in order to parse and basically know what action a line of code does...

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.