🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Template questions

#2603
From: David Vandevoorde
Date: Fri, 17 Nov 1995 05:46
30 lines
1703 bytes
>>>>> "BK" == Bob Kline <bkline@cortex.nlm.nih.gov> writes:
[...]
BK> Here's the other case:

BK> template<size_t N> bitset<N> operator&(const bitset<N>& lhs, const
BK> bitset<N>& rhs) { return bitset<N>(lhs) &= rhs; }

BK> To which the compiler responds:

BK> "./bitset", line 333: Error: The template argument N is not a
BK> type.

BK> Why is this?  The same compiler accepts the "template<size_t N>
BK> class bitset { ... }" quoted above, so I'm puzzled.  However, this
BK> isn't the only compiler which accepts the first use of a non-type
BK> template argument and rejects the second, so I'm beginning to
BK> suspect I'm just missing something obvious.  Can someone point it
BK> out to me, please?

Until not so long ago, non-type template parameters were prohibited
for function templates (e.g., see ARM 14.4). Many compilers still
impose that limitation.

	Daveed



[ 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: <VANDEVOD.95Nov16144406@avs.cs.rpi.edu>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <48e62h$itn@lhc.nlm.nih.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: vandevod@cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: Template questions
Date: 17 Nov 1995 05:46:58 GMT
Organization: RPI Computer Science
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <VANDEVOD.95Nov16144406@avs.cs.rpi.edu>
References: <48e62h$itn@lhc.nlm.nih.gov>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: avs.cs.rpi.edu
In-Reply-To: bkline@cortex.nlm.nih.gov's message of 16 Nov 1995 16:06:46 GMT
Content-Length: 872
Originator: clamage@taumet