Article View: comp.std.c++
Article #1885Re: Equivalence of A and A<>
From: Fergus Henderson
Date: Fri, 01 Sep 1995 17:44
Date: Fri, 01 Sep 1995 17:44
30 lines
1719 bytes
1719 bytes
gcato@st6000.sct.edu (Vaughn Cato) wrote:
>template <class T = int> class A;
>
>void f() {
> A<> *p1; // The legal way to default the argument
> A *p2; // Syntax error
>}
This has been discussed by the committee - I think the conclusion was that
allowing the simpler syntax would cause some problems, but I don't remember
off-hand what those problems were.
Perhaps the problem is ambiguity between `<' as less-than and `<' as
the start of a template angle bracket pair, e.g.
template <int i = 42> struct A { A(int = 0) {} };
foo(*new A<0>(0));
// should that be parsed as `foo((*new A) < 0) > 0)'??
?
--
Fergus Henderson | #define x t=a[i],a[i]=a[m],a[m]=t
| char a[]=" 12345678";main(m,i,j,t){for(i=m;i<
fjh@cs.mu.oz.au | 9;x,i++)for(x,j=m;--j?(t=a[m-j]-a[m])-j&&t+j:
http://www.cs.mu.oz.au/~fjh | main(m+1)*0;);m-9||puts(a+1);} /* 8 queens */
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<9524503.22797@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageReferences:
<199508241251.IAA03008@gold.interlog.com> <MATT.95Aug24145052@physics2.Berkeley.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson) Newsgroups: comp.std.c++ Subject: Re: Equivalence of A and A<> Date: 1 Sep 1995 17:44:19 GMT Organization: Computer Science, University of Melbourne, Australia Sender: news@cs.mu.OZ.AU (CS-Usenet) Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <9524503.22797@mulga.cs.mu.OZ.AU> References: <199508241251.IAA03008@gold.interlog.com> <MATT.95Aug24145052@physics2.Berkeley.EDU> NNTP-Posting-Host: taumet.eng.sun.com Originator: clamage@taumet