lua-users home
lua-l archive

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


On Tue, May 4, 2010 at 11:42 AM, Benoit Germain <bgermain@ubisoft.fr> wrote:
> The idea would be that with a true vector, there is no such thing as a hole (absent key), and iterating over vector elements can perfectly yield a [scalar/nil] pair without aborting the loop. For a vector, operator # *is* the same thing as std::vector::size(). Thus the highest integer key is the vector's size, and the values can be anything you want, and nil isn't a special case that breaks iteration, just a value like any other.

so a 'true vector' can't resize automatically, but you have to call
resize() (or change_capacity()?), since nil is a valid value and not
an absence.

-- 
Javier