---
title: "withUnsafeMutablePointerToElements(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/managedbuffer/withunsafemutablepointertoelements(_:)"
---

# withUnsafeMutablePointerToElements(_:)

Call body with an UnsafeMutablePointer to the Element storage.

## Declaration

```swift
final func withUnsafeMutablePointerToElements<E, R>(_ body: (UnsafeMutablePointer<Element>) throws(E) -> R) throws(E) -> R where E : Error, R : ~Copyable
```

## Discussion

Discussion note: This pointer is valid only for the duration of the call to body. The caller is responsible for ensuring that the buffer is not being accessed elsewhere while performing this call.
