This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Why does the [] operator in vector behave as it does?
- From: Ted Byers <r dot ted dot byers at rogers dot com>
- To: John Love-Jensen <eljay at adobe dot com>, Luke Dickens <lwd03 at doc dot ic dot ac dot uk>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 30 Apr 2008 11:15:07 -0400 (EDT)
- Subject: 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