On Tuesday 16 July 2002 3:58 pm, Andre Poenitz wrote: > On Tue, Jul 16, 2002 at 03:29:12PM +0100, Angus Leeming wrote: > > One more suggestion: naked pointers are evil. Naked pointers in an STL > > container are doubly evil. Wrap that pointer in a boost::shared_ptr. > > Memory is automatically delete-d as the list goes out of scope. > > Why are pointers used anyway? [I did not look at the source, so maybe the > question is silly]
You mean you'd prefer to pass around (possibly large) structs? Seems a little excessive. Anyway, if you prefer that then this will probably also be fine Martin. /// typedef std::map<string, Counter> CounterList; /// CounterList counterList; counterList[newc] = new Counter;