Generic Structure

AutoreleasingUnsafeMutablePointer

A mutable pointer-to-ObjC-pointer argument.

Declaration

struct AutoreleasingUnsafeMutablePointer<Pointee>

Overview

This type has implicit conversions to allow passing any of the following to a C or ObjC API:

  • nil, which gets passed as a null pointer,

  • an inout argument of the referenced type, which gets passed as a pointer to a writeback temporary with autoreleasing ownership semantics,

  • an UnsafeMutablePointer<Pointee>, which is passed as-is.

Passing pointers to mutable arrays of ObjC class pointers is not directly supported. Unlike UnsafeMutablePointer<Pointee>, AutoreleasingUnsafeMutablePointer<Pointee> must reference storage that does not own a reference count to the referenced value. UnsafeMutablePointer’s operations, by contrast, assume that the referenced storage owns values loaded from or stored to it.

This type does not carry an owner pointer unlike the other C*Pointer types because it only needs to reference the results of inout conversions, which already have writeback-scoped lifetime.

Topics

Converting Pointers

init?<U>(UnsafeMutablePointer<U>?)

Explicit construction from an UnsafeMutablePointer.

init<U>(UnsafeMutablePointer<U>)

Explicit construction from an UnsafeMutablePointer.

Accessing a Pointer's Memory

var pointee: Pointee

Access the Pointee instance referenced by self.

subscript(Int) -> Pointee

Access the ith element of the raw array pointed to by self.

Comparing Pointers

Operator Functions

static func < (AutoreleasingUnsafeMutablePointer<Pointee>, AutoreleasingUnsafeMutablePointer<Pointee>) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

static func <= (AutoreleasingUnsafeMutablePointer<Pointee>, AutoreleasingUnsafeMutablePointer<Pointee>) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

static func > (AutoreleasingUnsafeMutablePointer<Pointee>, AutoreleasingUnsafeMutablePointer<Pointee>) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

static func >= (AutoreleasingUnsafeMutablePointer<Pointee>, AutoreleasingUnsafeMutablePointer<Pointee>) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

Relationships

Conforms To

See Also

C and Objective-C Pointers

struct OpaquePointer

A wrapper around an opaque C pointer.