Why does the [] operator in vector behave as it does?

Ted Byers r.ted.byers@rogers.com
Wed Apr 30 16:38:00 GMT 2008


Hi All,

An option Eljay didn't mention, which I use almost all
the time (certainly every time I may have a large
number of objects of a given UDT, as I always manage
such collections with one of the STL containers), is
to store your objects on the heap and manage them
through smart pointers (I prefer those in boost - but
any that have the right semantics for STL containers
will do).  They are assignable, and will take care of
deleting your objects at the right time.

HTH

Ted



More information about the Gcc-help mailing list