Home > Back-end >  C, the template with Angle brackets behind the name of the class, what is the meaning of this writin
C, the template with Angle brackets behind the name of the class, what is the meaning of this writin

Time:10-03

Written as follows (c + +) :
Template
Struct MyTemplate{
.
};

Template class name MyTemplate behind & lt; Ret (Args... ) & gt; Ret (Args... ), at first glance, like a variable-length argument function template calls, but not consider feeling, here call up a what role, this kind of writing, what you mean? And detailed answers still hope ace to give advice or comments, thanks.

CodePudding user response:

Ret (Args... ), Ret is the return type, the Args... Is a variable-length argument types, the Ret (Args... ) as a whole is a function prototype, or function type,
Imagine a function pointer type Ret (*) (Args... ),

The code is not complete, estimating template Struct MyTemplate Struct MyTemplate partial specialization, T partial specialization into a function,

 
Template
Struct MyTemplate
{

};

Template
Struct MyTemplate{

};

CodePudding user response:

reference 1st floor SDGHCHJ response:
Ret (Args... ), Ret is the return type, the Args... Is a variable-length argument types, the Ret (Args... ) as a whole is a function prototype, or function type,
Imagine a function pointer type Ret (*) (Args... ),

The code is not complete, estimating template Struct MyTemplate Struct MyTemplate partial specialization, T partial specialization into a function,

 
Template
Struct MyTemplate
{

};

Template
Struct MyTemplate{

};


Thank you,,,

CodePudding user response:

You, won't knot stick