[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [aspell-devel] Saving pointers to std::vector data

From: Kevin Atkinson
Subject: Re: [aspell-devel] Saving pointers to std::vector data
Date: Sun, 28 Aug 2005 17:10:46 -0600 (MDT)

On Sat, 27 Aug 2005, Gary Setter wrote:

> My recollection is that the addresses of object in standard
> template library container object are not guaranteed to stay
> valid. The
> class is suppose to be able to reallocate memory as it needs to.
> Can anyone here back me up on this?

For std::vector the address should remain valid as long as the size of the 
object is not changed.  Gcc and possible also VC std:vector never shrink 
so decreasing the size does not invalid address references into an object.  
It could be the case the with BCB shrinking an object causes a 
reallocation.   Other objects (including the string class) do not offer 
such a guarantee.

> My plan is to continue looking into this and I may submit a
> patch that eliminates the WordEntry intr field and replaces it
> with code that retrieves the data more directly. How I continue
> will be effected by your comments.

Please submit a patch.  I may suggest an alternate solution but I need to 
see your changes first.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]