---
title: "moveUpdate(fromContentsOf:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/unsafemutablebufferpointer/moveupdate(fromcontentsof:)-522y2"
---

# moveUpdate(fromContentsOf:)

Updates this buffer’s initialized memory by moving every element from the source buffer, leaving the source memory uninitialized.

## Declaration

```swift
func moveUpdate(fromContentsOf source: UnsafeMutableBufferPointer<Element>) -> UnsafeMutableBufferPointer<Element>.Index
```

## Parameters

- `source`: A buffer containing the values to move. The memory region underlying source must be initialized.

## Return Value

Return Value An index one past the index of the last element updated.

## Discussion

Discussion Prior to calling the moveUpdate(fromContentsOf:) method on a buffer, the first source.count elements of the buffer’s memory must be initialized, or the buffer’s Element type must be a trivial type. The memory referenced by source is uninitialized after the function returns. The buffer must reference enough initialized memory to accommodate source.count elements. The returned index is one past the index of the last element updated. If source contains no elements, the returned index is equal to the buffer’s startIndex. If source contains as many elements as the buffer can hold, the returned index is equal to the buffer’s endIndex. note: The memory regions referenced by source and this buffer must not overlap. note: self.count >= source.count
