Re: std::map question

From: Flzw (flownz_at_wanadoo.fr)
Date: 08/14/04


Date: Sat, 14 Aug 2004 20:16:52 +0200


> It would be better not to *work around* this but to redesign the
> implementation of CObject. The way it is right now, destruction of one
> instance will invalidate all copies that exist somewhere else. This does
> not only make the use of containers impossible but is somewhat dangerous
> anyway.

True.

But I thought std containers were efficient. Here with this line, it creates
4 instances of the object and deletes three... Is it really worth it ?

I mean, I will switch to std::map <string, CObject*> from std::map <string,
CObject> and handle new / delete myself I won't need to introduce shared
pointers and it will be MUCH faster (to code and to run).