Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!devnull!kelley@mpd.tandem.com From: kelley@mpd.tandem.com (Michael Kelley) Newsgroups: comp.lang.c++ Subject: Re: Generics in C++ Keywords: generic Message-ID: <172@devnull.mpd.tandem.com> Date: 10 Apr 91 16:50:44 GMT References: <1991Apr9.221621.15934@netcom.COM> <1410@h.cs.wvu.wvnet.edu> Sender: news@devnull.mpd.tandem.com Lines: 46 > In article <1410@h.cs.wvu.wvnet.edu> schiebel@cs.wvu.wvnet.edu (Darrell Schiebel) writes: > > > >We are designing a reuseable software library based on C++ components. > >Currently we are exploring the various (twisted) ways of implementing > >a "generics" layer on C++. The alternatives seem to be: > > > > 1) Pointer Based Objects on top of C++ (Smalltalkish) > > can you give more detas? Is this just polymorphism > > > 2) Pre-processor based macro generics with type substitution and > > using the "generic header file." > > I would advice you avoid using macros, if for no other reason than > they are hard to debug. Try using templeting instead > > > 3) A yacc/sed/awk preprocessor for implimenting the generics > > ((C++)++) > > sound like this would be even worse than using generic.h. (At least > using generic.h is in the domain of c++) > You got it! There is a better way... I pulled a PD version of a Decus (???) cpp that Texas Instruments had extended to support templates a number of months ago -- I can't remember the internet address. (Mary, Dan -- you there?) The syntax for defining the templates is a bit different than E&S, and the mechanism for declaring/defining actual classes from templates may not be the same as that coming out of the ANSI-C++ committee. (By the way, just what is the status on this matter?) But, *using* them is consistent -- we've been doing so with the standard lists and dictionaries, and are getting to the point it's hard to imagine doing without. Hope this helps. Mike Kelley Tandem Computers, Austin, TX kelley@mpd.tandem.com (512) 244-8830 / Fax (512) 244-8247