<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabularData",
  "identifier" : "/documentation/TabularData/Column/withContiguousMutableStorageIfAvailable(_:)-9j9p8",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData6ColumnV39withContiguousMutableStorageIfAvailableyqd__Sgqd__SryxGzKXEKlF"
  },
  "title" : "withContiguousMutableStorageIfAvailable(_:)"
}
-->

# withContiguousMutableStorageIfAvailable(_:)

Call `body(buffer)`, where `buffer` provides access to the non-optional contiguous mutable storage of the
entire column. If the column contains missing values, `body` is not called and `nil` is returned.

```
mutating func withContiguousMutableStorageIfAvailable<R>(_ body: (inout UnsafeMutableBufferPointer<WrappedElement>) throws -> R) rethrows -> R?
```

## Parameters

`body`

a closure to be executed using the elements of this collection.

## Return Value

the value returned by `body`, or `nil`.

## Discussion

The optimizer can often eliminate bounds- and uniqueness-checking within an algorithm. When that fails,
however, invoking the same algorithm on `body`’s argument may let you trade safety for speed.

> Note: `buffer` must not be replaced by `body`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)