Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!ditka!zinn!nuucp From: mjv@objects.mv.com (Michael J. Vilot) Newsgroups: comp.lang.c++ Subject: RE: Generics in C++ Message-ID: <1274@zinn.MV.COM> Date: 10 Apr 91 11:43:12 GMT Sender: news@ditka.chicago.com (Pulitzer at ditka) Lines: 38 >From cs.wvu.wvnet.edu!schiebel >Newsgroups: comp.lang.c++ >Keywords: generic >Message-ID: <1410@h.cs.wvu.wvnet.edu> > >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) > 2) Pre-processor based macro generics with type substitution and > using the "generic header file." > 3) A yacc/sed/awk preprocessor for implimenting the generics > ((C++)++) > >Does anyone have a better solution? I faced exactly this problem when designing the C++ Booch Components library. I decided on: 4) A template filter program (written in C++) that implements the (essential parts of) template processing described in Chapter 14 of "The Annotated Reference Manual." The filter sits between cpp and the C++ compiler. This approach let me build the library using the syntax that will eventually be supported in all C++ implementations, and make the library available on any platform supporting C++. For more details, you might want to read the paper Grady and I presented: "The Design of the C++ Booch Components," OOPSLA/ECOOP Conference, Ottawa Canada, October 1990, p. 1. Hope this helps, Mike