_ArrayBufferType

protocol _ArrayBufferType

The underlying buffer for an ArrayType conforms to _ArrayBufferType. This buffer does not provide value semantics.

Inheritance CollectionType, MutableCollectionType, SequenceType, _CollectionType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Element

The type of elements stored in the buffer

Generator : GeneratorType

A type that provides the sequence's iteration interface and encapsulates its iteration state.

Index : ForwardIndexType

A type that represents a valid position in the collection.

Valid indices consist of the position of every element and a "past the end" position that's not valid for use as a subscript.

_Element

A type that represents a valid position in the collection.

Valid indices consist of the position of every element and a "past the end" position that's not valid for use as a subscript.

Import import Swift

Initializers

init() Required

create an empty buffer

Declaration

init()
init(_:) Required

Adopt the storage of x

Declaration

init(_ buffer: _ContiguousArrayBuffer<Element>)

Instance Variables

var baseAddress: UnsafeMutablePointer<Element> Required

If the elements are stored contiguously, a pointer to the first element. Otherwise, nil.

Declaration

var baseAddress: UnsafeMutablePointer<Element> { get }
var capacity: Int Required

How many elements the buffer can store without reallocation

Declaration

var capacity: Int { get }
var count: Int Required

How many elements the buffer stores

Declaration

var count: Int { get set }
var identity: UnsafePointer<Void> Required

A value that identifies the storage used by the buffer. Two buffers address the same elements when they have the same identity and count.

Declaration

var identity: UnsafePointer<Void> { get }
var owner: AnyObject Required

An object that keeps the elements stored in this buffer alive

Declaration

var owner: AnyObject { get }
var endIndex: Index Required

The collection's "past the end" position.

endIndex is not a valid argument to subscript, and is always reachable from startIndex by zero or more applications of successor().

Declaration

var endIndex: Index { get }

Declared In

_CollectionType
var startIndex: Index Required

The position of the first element in a non-empty collection.

Identical to endIndex in an empty collection.

Declaration

var startIndex: Index { get }

Declared In

_CollectionType

Subscripts

subscript(_: Int) Required

Declaration

subscript(index: Int) -> Element { get nonmutating set }
subscript(_: Range<Int>) Required

Declaration

subscript(subRange: Range<Int>) -> _SliceBuffer<Element> { get }
subscript(_: Self.Index) Required

Declaration

subscript(position: Self.Index) -> Self.Generator.Element { get }

Declared In

CollectionType, MutableCollectionType
subscript(_: Index) Required

Declaration

subscript(_i: Index) -> _Element { get }

Declared In

_CollectionType

Instance Methods

func _uninitializedCopy(_:target:) Required

Copy the given subRange of this buffer into uninitialized memory starting at target. Return a pointer past-the-end of the just-initialized memory.

Declaration

func _uninitializedCopy(subRange: Range<Int>, target: UnsafeMutablePointer<Element>) -> UnsafeMutablePointer<Element>
func generate() Required

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

func generate() -> Generator

Declared In

SequenceType, _Sequence_Type
mutating func isMutableAndUniquelyReferenced() Required

Returns true iff this buffer is backed by a uniquely-referenced mutable _ContiguousArrayBuffer.

Note: this function must remain mutating; otherwise the buffer may acquire spurious extra references, which will cause unnecessary reallocation.

Declaration

mutating func isMutableAndUniquelyReferenced() -> Bool
mutating func replace(_:with:elementsOf:) Required

Replace the given subRange with the first newCount elements of the given collection.

Requires: this buffer is backed by a uniquely-referenced _ContiguousArrayBuffer

Declaration

mutating func replace<C : CollectionType where Self.Element == Element>(#subRange: Range<Int>, with newCount: Int, elementsOf newValues: C)
func requestNativeBuffer() Required

If this buffer is backed by a _ContiguousArrayBuffer containing the same number of elements as self, return it. Otherwise, return nil.

Declaration

func requestNativeBuffer() -> _ContiguousArrayBuffer<Element>?
mutating func requestUniqueMutableBackingBuffer(_:) Required

If this buffer is backed by a uniquely-referenced mutable ContiguousArrayBuffer that can be grown in-place to allow the self buffer store minimumCapacity elements, returns that buffer. Otherwise, returns nil. Note: the result's baseAddress may not match ours, if we are a SliceBuffer.

Note: this function must remain mutating; otherwise the buffer may acquire spurious extra references, which will cause unnecessary reallocation.

Declaration

mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int) -> _ContiguousArrayBuffer<Element>?
func withUnsafeBufferPointer(_:) Required

Call body(p), where p is an UnsafeBufferPointer over the underlying contiguous storage. If no such storage exists, it is created on-demand.

Declaration

func withUnsafeBufferPointer<R>(body: @noescape (UnsafeBufferPointer<Element>) -> R) -> R
mutating func withUnsafeMutableBufferPointer(_:) Required

Call body(p), where p is an UnsafeMutableBufferPointer over the underlying contiguous storage. Requires: such contiguous storage exists or the buffer is empty

Declaration

mutating func withUnsafeMutableBufferPointer<R>(body: @noescape (UnsafeMutableBufferPointer<Element>) -> R) -> R