Topic: function parameter list must use template parameter


Author: kv <vkrishnamurthy@statestreet.com.--->
Date: 1997/04/04
Raw View
hi

This is in regards to function templates.  Some compilers flag
it as an error if the function parameter list does not use all
the template parameters.

I have browsed thru the CD2 and have not found this to be a
requirement !

On contemplation, though, I find this justified.  Else, we have
two cases

1. the compiler instantiates this function for all the classes
it knows about,

2. the programmer has to instantiate before s/he uses this function

These issues do not seem to be addressed by the CD.

Can someone set me on the right track?

thanx
kv

--
Please remove the .--- from the end of my address to reach me.

"If you are not living on the edge, you are taking up too much space."
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Date: 1997/04/04
Raw View
kv <vkrishnamurthy@statestreet.com.---> writes:

>This is in regards to function templates.  Some compilers flag
>it as an error if the function parameter list does not use all
>the template parameters.

Such compilers do not conform to the DWP.

>These issues do not seem to be addressed by the CD.

They are.  Function template parameters which cannot be deducted
from the function arguments must be given explicitly at the call
site, e.g.

 template <class T> void foo(void);
 ...
 foo<int>();

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]