TITLE: Passing Template Class w/ Constant Args PROBLEM: Randall H. Hopper (rhhopper@steven.b15.ingr.com) What is the syntax for declaring an ordinary function that takes as a parameter a template class declared with a constant parameter? template int operator == (const Tuple &T1, const Tuple &T2) {/*...*/} Borland C++ 3.1 doesn't like this, claiming that "template functions may only have 'type-arguments'". RESPONSE: <2pihma$me6@rzsun02.rrz.uni-hamburg.de> Bernd Eggink As far as I know, this is true, and is constantly annoying me, too. The argument for this rule is that the compiler must be able to deduce the actual template arguments from the arguments of the function call (ARM p.347). This argument is false in cases like yours, where a simple type affects the argument type. Here the compiler could very well deduce the int template argument from the function call. Apparently nobody thought of this or considered it worthwile. RESPONSE: jamshid@ses.com (Jamshid Afshar) The ARM was (by Stroustrup's own admission) very conservative in its definition of templates. It's been known for quite some time that non-type template arguments could and should be allowed for function templates. The January 1994 ANSI/ISO Working Paper already allows them. So, the above operator==() will very likely be legal ANSI/ISO C++. Btw, the proposed bit set class uses such a function template: template class bits { public: //... bits& set(size_t pos, int val=1); }; template ostream& operator<<( ostream&, const bits& ); I believe even the following will be legal: template void manipulate( T (&m)[i] ) { T tmp[i]; //... } void f() { double n[50]; manipulate(n); // compiler deduces T==double and i==50 int m[] = { 1, 2, 3 }; manipulate(m); // yes, I think even this will be legal } See Stroustrup's _Design and Evolution of C++_ Chapter 15 for this and other information about extensions and clarifications to templates since the ARM was published.