Skip to content

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

Closed
@simonster

Description

@simonster

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions