From -1029164548100274616
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,1c452393d407b15c
X-Google-Attributes: gidf78e5,public
From: juergen@monocerus.demon.co.uk (Juergen Heinzl)
Subject: Re: removing list elements
Date: 1999/03/18
Message-ID: <slrn7er0di.ndc.juergen@monocerus.demon.co.uk>#1/1
X-Deja-AN: 456220495
X-NNTP-Posting-Host: monocerus.demon.co.uk:212.229.5.80
Content-Transfer-Encoding: 8bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7cj8nk$tmk$1@nnrp1.dejanews.com>
To: undisclosed-recipients:;
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=iso-8859-1
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 921537488 nnrp-08:11057 NO-IDENT monocerus.demon.co.uk:212.229.5.80
Organization: Rent A Bug Ltd
Mime-Version: 1.0
User-Agent: slrn/0.9.5.4 (UNIX)
Newsgroups: comp.std.c++
X-MIME-Autoconverted: from quoted-printable to 8bit by ha2mpka.eng.sun.com id VAA22496
Originator: clamage@taumet


In article <7cj8nk$tmk$1@nnrp1.dejanews.com>, alexxandra@my-dejanews.com wrote:
>
>This problem has been described to me by a fellow developer, and I cannot find
>much insight online or in books.  Using the STL list, we wanted to substitute
>our home-grown implementation of a linked list.  However, we were storing
>(pointers or references to) objects in the linked list and we've run into a
>problem with the code dumping core from the stl section.  Should I assume it
>is the developer's responsibility to remove the object when objects and not
>straight data are being stored in the list?  If so, would a reasonable
>solution be to overload list's remove() to call the destructor on the object
>being removed?
>
>Any insight/input/advice is very welcome.

Just an idea ... do you have a copy constructor and if ... shallow or deep
copy ? For pointers you might consider smart pointers and regarding the STL
containers AFAIK objects must support = and <

Cheers,
Juergen

-- 
\ Real name     : J�rgen Heinzl                 \       no flames      /
 \ EMail Private : juergen@monocerus.demon.co.uk \ send money instead /
  \ Phone Private : +44 181-332 0750              \                  /



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




