yet another template instantiation problem (w/ short snapshot :)
Alexandre Oliva
oliva@dcc.unicamp.br
Thu Oct 30 13:15:00 GMT 1997
Max Lawson writes:
> The following program doesn't compile with egcs-971023 on a
> i586-pc-linux-glibc1 box (libc5.4.39; boot_cflags="-g -O2")
egcs is correct.
> template<class O, class T>
> class mu_mem_fun_mvars
This declares a class, but then you use it as a function:
> cout << bar(mu_mem_fun_mvars(ff,&foo::f)) << endl;
> => Could sbdy explain me why the call to the class "mu_mem_fun_mvars"
> constructor isn't handled the right way ?
There's no such thing as a call to a constructor, since there's no
class named mu_mem_fun_mvars. You could achieve the desired effect by
defining a template function:
template<class O, class T>
mu_mem_fun_mvars<O,T> mu_mem_fun_mvars_f(O& obj, T (O::*m_func)(const T&)) {
return mu_mem_fun_mvars<O,T>(obj, m_func);
}
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list