ma740988 wrote:
I asked you which 'foo_test' you were trying to call _inside_ each
of those specialisations. Why do I have to repeat myself? That's probably because I dont understand what you're asking me.
Did you read your original post? Did you read my reply to it?
foo_test<double>(ptr_t);
should call
template<> inline void foo_test<double> ( const double* ptr )
which calls
template <typename T>
void foo_test ( T const* ptr ){}
What am I missing?
Common sense, most likely.
.. template<class T> int foo(T t) { return 42; }
.. template<> int foo<double>(double d) { return foo(d); }
.. ^^^^^^^^^^^^^
Why in hell would the marked call be to the generic template, when 'd'
is already a 'double' and there is a specialisation for 'double'?
If you intended to call the non-specialised version of 'foo', then you
don't need to specialise the template. Just use overloaded functions:
template<class T> int foo(T t) { return 42; }
int foo(double d) { return foo<double>(d); }
and you will have no recursion.
V
--
Please remove capital As from my address when replying by mail