🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Determining between classes and built-in t

#2224
From: David Vandevoorde
Date: Mon, 16 Oct 1995 23:41
30 lines
1833 bytes
>>>>> "AM" == Alex Martelli <martelli@cadlab.cadlab.it> writes:
[...]
AM> So, ask for _that_... have a "template<class T> bool
AM> can_memmove()" that returns false by default, specialize it to
AM> return true for types that CAN be moved by memmove() (all
AM> built-ins, but also several non-built-ins, such as complex), and
AM> further allow the user of your library to specialize it that way
AM> for _their_ own memmove'able types.

Or make an array_move<T>(...) function with suitable specializations.

[...]
AM> The only problem, as usual, is with _pointers_, since you cannot
AM> specialize a template for "pointers to *anything*", alas:-(.  Now
AM> THAT would be a neat little thing indeed to have -- a rule
AM> allowing a template to co-exist for both "any class" AND "any
AM> pointer", with the latter taking precedence if both versions exist
AM> and the template is instantiated for a pointer...

Such a rule is in the DWP (let me know if your compiler supports it,
mine doesn't :-). BTW, this is called partial specialization...

	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.95Oct16193053@avs.cs.rpi.edu>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <Pine.SGI.3.91.951003143924.20596A-100000@gusak> <450v2o$f3g@engnews2.Eng.Sun.COM> <45mor5$fms@jupiter.SJSU.EDU> <martelli.813831475@cadlab>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: vandevod@cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: Determining between classes and built-in t
Date: 16 Oct 1995 23:41:30 GMT
Organization: RPI Computer Science
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <VANDEVOD.95Oct16193053@avs.cs.rpi.edu>
References: <Pine.SGI.3.91.951003143924.20596A-100000@gusak>
 <450v2o$f3g@engnews2.Eng.Sun.COM> <45mor5$fms@jupiter.SJSU.EDU>
 <martelli.813831475@cadlab>
NNTP-Posting-Host: physics2.berkeley.edu