Newsgroups: comp.lang.c++ Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!arrayb!wicklund From: wicklund@intellistor.com (Tom Wicklund) Subject: Re: How to define a List class Message-ID: <1991Jun11.172115.2804@intellistor.com> Organization: Intellistor References: <350001@hpgnd.grenoble.hp.com> <28539115.4D91@tct.com> Date: Tue, 11 Jun 91 17:21:15 GMT In <28539115.4D91@tct.com> chip@tct.com (Chip Salzenberg) writes: >According to jr@hpgnd.grenoble.hp.com (Jean-Ren BOUVIER): >>I'm looking for ideas in the classical area of "list" packages. ... >> >>I DON'T want to consider solutions based on templates (List >>types) or generic classes - as I don't want to replicate code. >Well, then, you've got very few alternatives. In C++, you cannot have >all three of minimal-code polymorphism, type safety and involiate base >classes. That is because the three approaches to the downcasting >problem fall short in one way or another: I think what's desired (and should be implementable) is a way to define a list class using templates and have the compiler be smart enough to create a single implementation for the list methods. This should be possible by having additional information (such as a pointer to the copy constructor for the item being placed in the list) passed into member functions -- doable but not common in today's compiler technology.