Topic: address of template function (13.4)


Author: Nikolas Kauer <nkauer@my-deja.com>
Date: 2000/06/16
Raw View
I've a question about taking the address of a function
template specialization with a template argument list
that is explicitly specified.

13.4 (2) says that "[i]f the name is a function template,
template argument deduction is done (14.8.2.2), [...]"

14.8.2.2 deals with "Deducing template arguments taking the
address of a function template" and does so based on
the function template's function type and the specified
type for the function pointer.

Now consider a case with a non-type template argument:

template<int i> void ftmpl(double x[]);

typedef void (*FPtr)(double x[]);

FPtr fptr = &ftmpl<3>;

Is this legal according to the C++ standard?

If I would not explicitly specify the template argument
implicit template argument deduction would fail, since
the function arguments are the same for all template
specializations.  But with explicitly specified
template argument everything seems to be well-defined.

Nevertheless, the compiler gives me a "cannot overload
functions based on pointer size of the parameters alone"
error.  (I used Compaq C++.)


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]