This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]