Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c++ Subject: About Lists and things ... Mostly requests for info. Message-ID: <18939@prometheus.megatest.UUCP> Date: 17 Jun 91 02:36:03 GMT Organization: Megatest Corporation, San Jose, Ca Lines: 55 Hello, First a couple of requests: 1. I would appreciate it if someone would send me the article titled "How to define a List class (summary)". 2. I've only recently re-subscribed to this group, and I fear I've missed quite a bit. Where can I find out about the plans for language extensions such as parameterized types, templates, catch-and-throw, et cetera? I've just bought a stack of back-issues of _C++ Report_ and some other literature, but there is little there on these topics. Perhaps there is a conference coming up soon? I'm in the mood for a boondoggle. Concerning (1)... For the last six years or so I've been doing the following in C, extern void* List_iter_next(); /* actually declared * in an include-file of course */ run_through(my_list) List *my_list; /* Linked list of SomeType (pointers) */ { List_iter iter; SomeType *member; List_iter_init(&iter, my_list); while( member = (SomeType*)List_iter_next(&iter)) { ... fiddle with *member } } C++ophiles will notice that in the vernacular of C++, List_iter_init() is a constructor for the class List_iter, and that the parameter &iter is the this-pointer. (No destructor is needed.) List_iter_next() is a member-function of the class List_iter. Of course, "List" has its complement of member-functions also, some "in-lined" with macros. (I wrote a whole libary that way before I ever heard of C++.) Anyway, the above works pretty well, except that I get millions of complaints from lint about the type-conversions from void*, and a new compiler I've been using complains about the "assignment inside a conditional". So far, I haven't been able to think up a much better solution in C++ because there's still the problem of casting the void* back to SomeType*. Perhaps parameterized types will save the day, but using #defines to generate do-nothing type-conversion routines does not seem like any improvement on the above. My principle value-metric for this is fewest key-strokes, not elegance, not type-security. I'm guessing that the "How to Define a List class (summary)" paper will show me the True Way. What is the popular wisdom?