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

Allow resizing of vectors at any position #57519

Open
Tortar opened this issue Feb 24, 2025 · 1 comment
Open

Allow resizing of vectors at any position #57519

Tortar opened this issue Feb 24, 2025 · 1 comment
Labels
arrays [a, r, r, a, y, s] feature Indicates new feature / enhancement requests

Comments

@Tortar
Copy link
Contributor

Tortar commented Feb 24, 2025

Resizing of vectors is currently supported only at the end (but after #57313 is merged, it will be possible to resize also at the start).

I think that having in the API something along the lines of resizeat!(a::Vector, n::Int, pos::Int) where pos indicates the position of the resizing makes sense (and similar for BitVector).

There is already an internal function to allow that for a Vector, i.e. _growat!, which has the nice property that the more you are near the extrema the more the resizing is faster.

@inkydragon inkydragon added arrays [a, r, r, a, y, s] feature Indicates new feature / enhancement requests labels Feb 24, 2025
@jakobnissen
Copy link
Contributor

Good idea! If this is implemented, then it would be nice to also define insert!(::Vector, ::UnitRange, xs) to be a resize! followed by a copyto!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] feature Indicates new feature / enhancement requests
Projects
None yet
Development

No branches or pull requests

3 participants