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

# withUnsafeShapedBufferPointer(_:)

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

## Declaration

```swift
func withUnsafeShapedBufferPointer<R>(_ body: (UnsafeBufferPointer<Self.Scalar>, [Int], [Int]) throws -> R) rethrows -> R
```

## Parameters

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

## Discussion

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

## See Also

### Inspecting a shaped array type

- [shape](coreml/mlshapedarrayprotocol/shape.md)
- [strides](coreml/mlshapedarrayprotocol/strides.md)
- [count](coreml/mlshapedarrayprotocol/count.md)
- [isScalar](coreml/mlshapedarrayprotocol/isscalar.md)
- [scalarCount](coreml/mlshapedarrayprotocol/scalarcount.md)
- [scalar](coreml/mlshapedarrayprotocol/scalar-swift.property.md)
- [scalars](coreml/mlshapedarrayprotocol/scalars.md)
