🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Syntax for template instantiation and specialization

#3889
From: Marian Hellema
Date: Tue, 02 Apr 1996 13:34
40 lines
1930 bytes
Hello,

What is the correct syntax for template instantiation and
specialization?

From my copy of the DWP April 95 I gather:

template<class T>
T max(T a, T b) { return a>b?a:b; }

template int max<int>(int, int);	//instantiation
/* OR: */ 
template int max<>(int, int);		//instantiation

const char* max<const char*>max(const char* a, const char* b)
{  /* specialization */ }
/* OR: */
const char* max<>(const char* a, const char* b)
{  /* specialization */ }

My questions are:
1. Is the above correct? I heard there are some recent changes
in this area.
2. Is the following still legal:
   int max(int, int);	//instantiation??

Thanks!
Marian

-- 
----------------------------------------------------------------------
Marian Hellema            AT Computing, UNIX training and consultancy
email: marian@atcmp.nl    P.O. Box 1428, 6501 BK Nijmegen
phone: +31 24 3527225     the Netherlands
---
[ 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: <4jr0ur$bdh@wn1.sci.kun.nl>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: Marian Hellema <marian@atcmp.nl>
Message-ID: <4jr0ur$bdh@wn1.sci.kun.nl>
X-Original-Date: 2 Apr 1996 10:53:15 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 02 Apr 96 13:34:59 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Syntax for template instantiation and specialization
Organization: AT Computing, Nijmegen, the Netherlands
X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.4 sun4m)
X-Url: news:comp.std.c++/19480-19494?ALL
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMWEtEuEDnX0m9pzZAQGulwGAoh2l/ClbhOcl0uZVjmNfvRX1Td1fU4Ta
 W/DEi9pPjFnc5QNNzv2Cp/3txoOYXp+4
 =Da6x