🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #46621

Templatized Member Functions??????

#46621
From: Matthew J. Powers
Date: Fri, 04 Nov 1994 21:52
45 lines
1965 bytes
Does anyone know if it is possible to templatize an individual
non-template class member function?  I already know that the
following code crashes gcc-2.6.0 (haven't built/tried 2.6.1 yet), but
I included it to give you the gist of what I want to do.

Can anyone offer any comments?  Thanks!

Matt Powers <---me!---> delayman@cadlips.ece.utexas.edu
http://www-lips.ece.utexas.edu/~delayman
Laboratory for Intelligent Processes and Systems (LIPS)
Department of Electrical and Computer Engineering	 phone: (512) 471-5350
The University of Texas at Austin			 FAX:	(512) 471-5532

-------------------------
// file tem_fn.hh
#pragma interface

#include <iostream.h>

class test{
protected:
  int a;

public:
  test ();
  blah(int, int);      // any way to have a templatized prototype?
  blah(float, float);  // I couldn't think/compile a good way to do it.
};

-------------------------
// file tem_fn.cc
#pragma implementation

#include "tem_fn.hh"

test::test(){cout << "In test ctor." << endl;}

template <class DataType>
test::blah(DataType arg1, DataType arg2){
  cout << "Testing.  arg1: " << arg1 << " arg2: " << arg2 << endl;
}

// "instantiation" of member function (??)
template test::blah(int arg1, int arg2);
template test::blah(float arg1, float arg2);
Technical Details
Message-ID: <39eaeu$g63@geraldo.cc.utexas.edu>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!gatech!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!usenet

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,4dfe2728b9253185,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1994-11-04 13:52:29 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!gatech!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!usenet
From: "Matthew J. Powers" <delayman@cadlips.ece.utexas.edu>
Newsgroups: gnu.gcc.help
Subject: Templatized Member Functions??????
Date: 4 Nov 1994 21:52:29 GMT
Organization: The University of Texas at Austin, Austin, Texas
Lines: 46
Message-ID: <39eaeu$g63@geraldo.cc.utexas.edu>
NNTP-Posting-Host: powerlips.ece.utexas.edu