---
title: "withUnsafeMutableShapedBufferPointer(_:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mlshapedarrayprotocol/withunsafemutableshapedbufferpointer(_:)"
---

# withUnsafeMutableShapedBufferPointer(_:)

Provides read-write access of the shaped array’s underlying memory to a closure.

## Declaration

```swift
mutating func withUnsafeMutableShapedBufferPointer<R>(_ body: (inout UnsafeMutableBufferPointer<Self.Scalar>, [Int], [Int]) throws -> R) rethrows -> R
```

## Parameters

- `body`: A closure that accesses a shaped array’s underlying memory.

## Discussion

Discussion The method returns the value your closure returns, if applicable.

## See Also

### Modifying a shaped array type

- [fill(with:)](coreml/mlshapedarrayprotocol/fill(with:).md)
