---
title: "init(rebasing:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/unsafebufferpointer/init(rebasing:)-56rdb"
---

# init(rebasing:)

Creates a buffer over the same memory as the given buffer slice.

## Declaration

```swift
init(rebasing slice: Slice<UnsafeBufferPointer<Element>>)
```

## Parameters

- `slice`: The buffer slice to rebase.

## Discussion

Discussion The new buffer represents the same region of memory as slice, but is indexed starting at zero instead of sharing indices with the original buffer. For example: let buffer = returnsABuffer() let n = 5 let slice = buffer[n...] let rebased = UnsafeBufferPointer(rebasing: slice) After rebasing slice as the rebased buffer, the following are true: rebased.startIndex == 0 rebased[0] == slice[n] rebased[0] == buffer[n] rebased.count == slice.count
