From 6751787650153392213 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,297e1191220ad2df X-Google-Attributes: gidf78e5,public From: hinnant@_anti-spam_metrowerks.com (Howard Hinnant) Subject: Re: [Q] function member template in a template class Date: 1999/05/07 Message-ID: #1/1 X-Deja-AN: 475221606 Approved: Valentin Bonnard References: X-Original-Date: Tue, 04 May 1999 10:54:46 -0400 Organization: Metrowerks X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUANzMYHqwEuYhIxRhxAQEP/gH+N8LJ94AV4blZhLddJ/nAscJqIM/k/RYY nAnWvT6MSjc04NuHawfiMu2NPU5XKRQ1nwXPeIhlf3FR3SY9s79THw== =xM13 X-Authentication-Warning: backdraft.briar.org: smap set sender to using -f Newsgroups: comp.std.c++ In article , "Gabor Greif" wrote: > { to moderator: I have posted this days ago, did not seem to have made it. > Nothing on dejanews. Did not got a rejection either... So I repost. } > > Here is a question I was not able to answer myself yesterday night... > > Suppose having a class template with two parameters and a function member > template in it (returning a two-parameter dependent result): > > template > struct Res { }; > > > template > struct Bar > { > template > typename Res foo(void); > }; > > What is the syntax for defining the function foo outside of the Bar > template? This ought to do it: template struct Res { }; template struct Bar { template typename Res foo(void); }; template template typename Res Bar::foo(void) { return Res(); } int main() { Bar<1, int> b; b.foo<2>(); } -Howard --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]