the types of its parameters and, if the function is a class member, the cv- qualifiers (if any) on the function itself and the class in which the member function is declared. The signature of a function template specialization includes the types of its template arguments. (14.5.5.1)
It's missing the return type in this definition, which is part of the signature of a function template specialization (i.e a function declaration that declares a function which is a specialization of a template), as pointed out by 14.5.5.1 (recent C++0x working papers fixed that already to mention the return type in 1.3.10 too):
The signature of a function template specialization consists of the signature of the function template and of the actual template arguments (whether explicitly specified or deduced).
The signature of a function template consists of its function signature, its return type and its template parameter list.
The most recent C++0x draft n3000 says about "signature" in 1.3.11, and it is:
the name and the parameter type list (8.3.5) of a function, as well as the class or namespace of which it is a member. If a function or function template is a class member its signature additionally includes the cv-qualifiers (if any) and the ref-qualifier (if any) on the function or function template itself. The signature of a function template additionally includes its return type and its template parameter list. The signature of a function template specialization includes the signature of the template of which it is a specialization and its template arguments (whether explicitly specified or deduced).
Some examples:
int func( void, int );
int func( int );
int func( void )
int func( int, void );
// valid
int func( void );
void func( void );
// invalid
int func( void );
void func( int );
// valid
template<typename T> int func( void );
template<typename T> void func( void );
// valid
Reference:
http://stackoverflow.com/questions/290038/is-the-return-type-part-of-the-function-signature
Related Posts:
Function Template Specialization
please function signature one example show
ReplyDelete