Skip to content

Add splice #39

@nnethercote

Description

@nnethercote

ThinVec currently lacks the splice method. In rust-lang/rust#104754 I converted a bunch of Vec instances in rustc to ThinVec for some performance wins. I had to change one use of splice like this:

-                alternatives.splice(idx..=idx, inner);
+ 
+                // Equivalent to `alternatives.splice(idx..=idx, inner);`.
+                alternatives.remove(idx);
+                for p in inner.into_iter().rev() {
+                    alternatives.insert(idx, p);
+                }

which could cause quadratic behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions