From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Max Lawson Cc: egcs-bugs@cygnus.com, egcs@cygnus.com Subject: Re: yet another template instantiation problem (w/ short snapshot :) Date: Thu, 30 Oct 1997 13:13:00 -0000 Message-id: References: <9710301653.AA13589@drfmc.ceng.cea.fr> X-SW-Source: 1997-10/msg01251.html 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 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 mu_mem_fun_mvars mu_mem_fun_mvars_f(O& obj, T (O::*m_func)(const T&)) { return mu_mem_fun_mvars(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