<!--
{
  "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/withContiguousStorageIfAvailable(_:)-6nbz3",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData6ColumnV32withContiguousStorageIfAvailableyqd__Sgqd__SRyxGKXEKlF"
  },
  "title" : "withContiguousStorageIfAvailable(_:)"
}
-->

# withContiguousStorageIfAvailable(_:)

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

```
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<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.

---

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)