🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Do we need a standard isPointer() function?

#2083
From: David Vandevoorde
Date: Sat, 30 Sep 1995 02:09
53 lines
2585 bytes
>>>>> "PH" == Pablo Halpern <phalpern@truffle.ultranet.com> writes:
In article <44hevp$ofa@caesar.ultra.net> phalpern@truffle.ultranet.com (Pablo Halpern) writes:
PH> fjh@munta.cs.mu.OZ.AU (Fergus Henderson) wrote:
[...]
>> phalpern@truffle.ultranet.com (Pablo Halpern) writes:
>> template <class T>
>> struct ext_type_info {
>> enum { is_pointer = false };	// assume T is not a pointer...
>> }

>> // define a partial specialization
>> template <class U>
>> struct ext_type_info<U *> {		// ... unless it matches this
>> enum { is_pointer = true };	// partial specialization
>> }
[...]
PH> This does not look like partial specialization to me. Partial

Many things could be called ``partial specialization''; e.g.:

	template<typename X>
	struct A { /* ... */ };

	template<typename T>
	struct A<vector<T> > { /* ... */ };

I believe (from hearsay :) that when partial specialization of class
templates was proposed, it was considered making my example legal.
To ensure realizability however, the committee chose to only accept
a subset of the proposal. This  subset includes what you mention
below, what Fergus Henderson proposes above (``pointer templates'')... 
but not my example.

PH> specialization, as I understand it, is where you specify implementation
PH> details for a template where one or more of the template paramters are
PH> known at compile time. The code above does not use compile-time
PH> parameters but uses a notation to *imply* that the "partialy
PH> specialized" template is for pointer parameters only. Is this really
PH> legal in the current WP? If not, my initial problem remains: is there a
PH> way to tell if a template parameter is a pointer and/or built-in type
PH> without extending the language?

It's in the DWP, according to my (incomplete) copy here, it should be
in Section 14.6 [templ.spec].

	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.95Sep29202019@avs.cs.rpi.edu>
Path: arc1-ca.pugleaf.net!tcsi.tcs.com!agate!agate!Matt
References: <439kkn$n81@caesar.ultra.net> <9525806.29066@mulga.cs.mu.OZ.AU> <44hevp$ofa@caesar.ultra.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!tcsi.tcs.com!agate!agate!Matt
From: vandevod@cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: Do we need a standard isPointer() function?
Date: 30 Sep 1995 02:09:54 GMT
Organization: RPI Computer Science
Approved: Matt@Austern
Message-ID: <VANDEVOD.95Sep29202019@avs.cs.rpi.edu>
References: <439kkn$n81@caesar.ultra.net> <9525806.29066@mulga.cs.mu.OZ.AU>
 <44hevp$ofa@caesar.ultra.net>
NNTP-Posting-Host: austern.hip.berkeley.edu