954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Settle a discussion about Template contruct

Here is the ?

To use a template construct, what phrase must come before the class definition?

My friend said that should be the parameter, but think that its the
argument,

Next ? is

in the statement

List mylist;

the word int is known as the template _______________?

I said it was the parameter, and my friend said that it was the argument.

can anybody help us out???

zebra59
Newbie Poster
7 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

>Here is the ?
>Next ? is
? is a sentence modifier. It has no meaning by itself in literature. Please spell out the word "question" for those of us that abhor useless abbreviations and shortcuts. Thanks.

>My friend said that should be the parameter, but think that its the argument
The whole thing is called a template declaration. The formal grammar for it is:

<em>template-declaration</em>:
        export<em>(opt)</em> template < <em>template-parameter-list</em> > <em>declaration</em>

Where the declaration at the end is a class or function definition. The parts before the declaration aren't treated as a single unit, and thus don't have a unifying name.

>I said it was the parameter, and my friend said that it was the argument.
The C++ standard calls it a parameter, so you're correct.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You