Re: Languages Mar 1999 16:04:43 GMT." <199903052204.RAA25713@pop02.globecomm.net>

From: Jeremy Elson (jelson@circlemud.org)
Date: 03/05/99


Warning: I'm pretty pro-STL so take what I say with the appropriate
bias. :-)

Chris Jacobson writes:
>On 3/5/99 9:33 PM, George (greerga@circlemud.org) stated:
>>How do people feel about C++ with STL?
>
>STL is a good system but is too generic for most purposes.

The fact that it's generic is why I like it -- I hate having to write
the same algorithms over and over again just because I'm using them on
different data types (e.g., removing an item from a list).  With STL
this is all pretty easy.

>Problems with
>STL include not being able to remove an item from a container class
>during iteration unless you pass the iterator.  This eliminates any
>chance of removing an item in any function during, for exmaple, the
>violence loop in fight.c.

This is a minor problem IMHO, and certainly no worse than our current
system where you already risk crashing if you remove something from a
list in the middle of iterating through it.  Bugs just like this crop
up over and over again over the years.  A new CircleMUD written
from scratch (which is the way I'd really rather go) might, say,
flag something as needing to be removed from a list, with garbage
collection at the end.

>Third, the map<> class works via linked list, IIRC, thus deminishing its
>uses.

Any implementation of map that uses linked lists is severely broken -
most use something very hard-core and fast like red-black trees.
(That's why the element you use to index it needs the < operator
defined in order to use it in a map<>).

-j


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST