Skip to content

container/list: MoveBefore/After would be useful #4940

@rogpeppe

Description

@rogpeppe
Currently there's no way of moving a list element to
an arbitrary place in the list without removing it
and using InsertBefore/After.

It's useful to be able to have external data structures
pointing at list elements that can move around arbitrarily,
so I suggest two new List methods:

// MoveAfter moves the element immediately after mark.
func (l *List) MoveAfter(e, mark *Element)

// MoveBefore moves the element immediately before mark.
func (l *List) MoveBefore(e, mark *Element)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions