This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: yet another template instantiation problem (w/ short snapshot :)
- To: Max Lawson <mlawson at drfmc dot ceng dot cea dot fr>
- Subject: Re: yet another template instantiation problem (w/ short snapshot :)
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 30 Oct 1997 19:06:06 -0200
- Cc: egcs-bugs at cygnus dot com, egcs at cygnus dot com
- References: <9710301653.AA13589@drfmc.ceng.cea.fr>
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