Class nested inside a template class as template function argument type

Class nested inside a template class as template function argument type

Post by claudi » Sat, 02 Apr 2011 20:51:24


Hi,

I run into a bit of trouble trying to compile the code below.

template<typename T>
struct Out
{
struct In{};
};

template<typename T>
void use(const typename Out<T>::In& r){}

void test()
{
use(Out<int>::In());
}

Using Comeau compiler I get the error:

line 13: error: no instance of function template "use" matches the
argument list
The argument types that you used are: (Out<int>::In)
use(Out<int>::In());
^

It looks like the template function use cannot deduce the argument
type but I can't understand why. Maybe someone out there can shed some
light on this?

Many thanks,
Claudiu
 
 
 

Class nested inside a template class as template function argument type

Post by August Kar » Sat, 02 Apr 2011 20:59:06


Try comp.lang.c++ instead.

/August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra

 
 
 

Class nested inside a template class as template function argument type

Post by claudi » Sat, 02 Apr 2011 21:10:17


Ooops, that's what I meant to do. Sorry.
 
 
 

Class nested inside a template class as template function argument type

Post by Sherm Pend » Sat, 02 Apr 2011 21:26:12

claudiu < XXXX@XXXXX.COM > writes:


Easy answer - C doesn't have templates.

sherm--

--
Sherm Pendley
< http://www.yqcomputer.com/ >
Cocoa Developer