🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #4053

Template argument deduction

#4053
From: Brian Michael Freyburger
Date: Mon, 15 Apr 1996 21:47
28 lines
1354 bytes
Reading section 14.10.2 of the January WP, I can not figure out
whether the following function call can be deduced:

template <class S, class T = S>
int foo(S s, T t = T());

int bar()
{
  foo(1);
}

The compiler must deduce that S is int from the one argument
specified, then determine that T is int from the default parameter for
T, and finally determine that the second argument has the default
value of int().


Thanks,

Brian Freyburger


[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <FREYBURG.96Apr15144107@glitch.stanford.edu>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: freyburg@glitch.stanford.edu (Brian Michael Freyburger)
Newsgroups: comp.std.c++
Subject: Template argument deduction
Date: 15 Apr 1996 21:47:00 GMT
Organization: Stanford University
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <FREYBURG.96Apr15144107@glitch.stanford.edu>
NNTP-Posting-Host: taumet.eng.sun.com
X-Nntp-Posting-Host: glitch.stanford.edu
Content-Length: 443
X-Lines: 21
Originator: clamage@taumet