[LLVMdev] is the SmallVector implementation standard c++?

Chris Lattner clattner at apple.com
Thu Aug 28 15:55:14 PDT 2008


On Aug 28, 2008, at 6:42 AM, Rafael Espindola wrote:

> While debugging a bootstrap problem, I noticed that SmallVector stores
> one element in SmallVectorImpl and N - 1 in SmallVector. It also
> assumes that all elements are continuous in memory. Does C++ makes any
> guaranties about the relative memory position of a base and parent
> classes?

It isn't guaranteed, but true of every implementation I know of.

> I haven't studied it a lot, maybe we can keep N elements in
> SmallVector and pass the pointer to SmallVectorImpl constructor?

If this would make SmallVector bigger and slower, then I think we  
should wait for an implementation that requires it.  If it is just a  
minor internal tweak, plz go for it.

-Chris



More information about the llvm-dev mailing list