Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert! semantics when index > length(collection)+1 #7373

Closed
simonster opened this issue Jun 22, 2014 · 1 comment
Closed

insert! semantics when index > length(collection)+1 #7373

simonster opened this issue Jun 22, 2014 · 1 comment

Comments

@simonster
Copy link
Member

When insert!(collection::Vector, index, item) is passed index > length(collection)+1, insert! goes ahead and inserts the item, and the elements in between the old end of the vector and index are uninitialized memory. Personally I think it would be safer to throw a BoundsError for this case, but if we leave things as is, we should document this.

@JeffBezanson
Copy link
Sponsor Member

A BoundsError in that case sounds like a good idea.

simonster added a commit that referenced this issue Jun 23, 2014
Ref #7373

Also fix return value of insert! to be the BitVector so it matches the
behavior for Vectors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants