mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
fix(package): [list] preserve source storage during merge (#391)
This commit is contained in:
1 parent
fe4c81a677
commit
febd1030af
2 files changed
+20
-2
No files matched your search
@@ -239,8 +239,8 @@ func (l *List[T]) Merge(other *List[T]) *List[T] {
|
||||
l1, l2 := len(l.data), len(other.data)
|
||||
ml := NewList(make([]T, l1+l2))
|
||||
|
||||
data := append([]T{}, append(l.data, other.data...)...)
|
||||
ml.data = data
|
||||
copy(ml.data, l.data)
|
||||
copy(ml.data[l1:], other.data)
|
||||
|
||||
return ml
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user