Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow 2-arg splice! on arbitrary index iterables (#34524)
We have deleteat!(vec::Vector, itr), but it returns the modified vector. If you instead want to obtain the delted elements, there is splice!(::Vector, ::UnitRange) as a special case of the three-argument version that inserts additional elements where the old ones were deleted. However, these is no two argument splice! for arbitrary iterables, so probably the best way to write that currently is: ``` inds = collect(itr) vals = A[inds] deleteat!(A, inds) vals ``` which is both less efficient and more verbose than ideal. I'm wondering if perhaps deleteat! should have been returning the deleted elements, but that's not a change we can make in 1.x. Instead, I'm proposing here to extend the 2 argument (but not the 3 argument for obvious reasons) variant of splice! to arbitrary iterables.
- Loading branch information
c2cd601
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Executing the daily benchmark build, I will reply here when finished:
@nanosoldier
runbenchmarks(ALL, isdaily = true)
c2cd601
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan