Initializerswift 6.0.1Swift
init(mutating:)
Creates a mutable typed pointer referencing the same memory as the given immutable pointer.
init(mutating other: UnsafePointer<Pointee>)
Parameters
- other
The immutable pointer to convert.
Other members in extension
Typealiases
typealias Distance
A type that represents the distance between two pointers.
Type members
init(UnsafeMutablePointer<Pointee>
) Creates a mutable typed pointer referencing the same memory as the given mutable pointer.
init?(UnsafeMutablePointer<Pointee>?
) Creates a mutable typed pointer referencing the same memory as the given mutable pointer.
init?(mutating: UnsafePointer<Pointee>?
) Creates a mutable typed pointer referencing the same memory as the given immutable pointer.
static func allocate(capacity: Int
) -> UnsafeMutablePointer<Pointee> Allocates uninitialized memory for the specified number of instances of type
Pointee
.
Instance members
var hashValue: Int
var pointee: Pointee
Reads or updates the instance referenced by this pointer.
subscript(Int
) -> Pointee Reads or updates the pointee at the specified offset from this pointer.
func deallocate(
) Deallocates the memory block previously allocated at this pointer.
func deinitialize(count: Int
) -> UnsafeMutableRawPointer Deinitializes the specified number of values starting at this pointer.
func initialize(from: UnsafePointer<Pointee>, count: Int
) Initializes the memory referenced by this pointer with the values starting at the given pointer.
func initialize(repeating: Pointee, count: Int
) Initializes this pointer’s memory with the specified number of consecutive copies of the given value.
func initialize(to: consuming Pointee
) Initializes this pointer’s memory with a single instance of the given value.
func move(
) -> Pointee Retrieves and returns the referenced instance, returning the pointer’s memory to an uninitialized state.
func moveInitialize(from: UnsafeMutablePointer<Pointee>, count: Int
) Moves instances from initialized source memory into the uninitialized memory referenced by this pointer, leaving the source memory uninitialized and the memory referenced by this pointer initialized.
func moveUpdate(from: UnsafeMutablePointer<Pointee>, count: Int
) Update this pointer’s initialized memory by moving the specified number of instances the source pointer’s memory, leaving the source memory uninitialized.
func pointer<Property>(to: KeyPath<Pointee, Property>
) -> UnsafePointer<Property>? Obtain a pointer to the stored property referred to by a key path.
func pointer<Property>(to: WritableKeyPath<Pointee, Property>
) -> UnsafeMutablePointer<Property>? Obtain a mutable pointer to the stored property referred to by a key path.
func update(from: UnsafePointer<Pointee>, count: Int
) Update this pointer’s initialized memory with the specified number of instances, copied from the given pointer’s memory.
func update(repeating: Pointee, count: Int
) Update this pointer’s initialized memory with the specified number of consecutive copies of the given value.
func withMemoryRebound<T, E, Result>(to: T.Type, capacity: Int, (UnsafeMutablePointer<T>)
throws Executes the given closure while temporarily binding memory to the specified number of instances of the given type.
Show obsolete interfaces (8)
Hide obsolete interfaces
var customPlaygroundQuickLook: PlaygroundQuickLook
func assign(from: UnsafePointer<Pointee>, count: Int
) func assign(repeating: Pointee, count: Int
) func deallocate(capacity: Int
) func deinitialize(
) -> UnsafeMutableRawPointer func initialize<C>(from: C
) Initializes memory starting at this pointer’s address with the elements of the given collection.
func initialize(to: Pointee, count: Int
) func moveAssign(from: UnsafeMutablePointer<Pointee>, count: Int
)