struct
UnsafeMutablePointer
<
Memory
>
Inheritance |
BidirectionalIndexType, CVarArgType, Comparable, CustomDebugStringConvertible, Equatable, ForwardIndexType, Hashable, NilLiteralConvertible, RandomAccessIndexType, Strideable, _Incrementable, _PointerType, _RandomAccessAmbiguity, _Reflectable, _Strideable
View Protocol Hierarchy →
|
---|---|
Associated Types |
|
Import |
|
Initializers
Construct a null pointer.
Declaration
init
()
Convert from an opaque C pointer to a typed pointer.
This is a fundamentally unsafe conversion.
Declaration
init
(
_
other
:
COpaquePointer
)
Convert from an UnsafeMutablePointer
of a different type.
This is a fundamentally unsafe conversion.
Declaration
init
<
U
>
(
_
from
:
UnsafeMutablePointer
<
U
>
)
Convert from a UnsafePointer
of a different type.
This is a fundamentally unsafe conversion.
Declaration
init
<
U
>
(
_
from
:
UnsafePointer
<
U
>
)
Construct an UnsafeMutablePointer
from a given address in memory.
This is a fundamentally unsafe conversion.
Declaration
init
(
bitPattern
:
Int
)
Construct an UnsafeMutablePointer
from a given address in memory.
This is a fundamentally unsafe conversion.
Declaration
init
(
bitPattern
:
UInt
)
Create an instance initialized with nil
.
Declaration
init
(
nilLiteral
: ())
Instance Variables
A textual representation of self
, suitable for debugging.
Declaration
var
debugDescription
:
String
{
get
}
The hash value.
Axiom: x == y
implies x.hashValue == y.hashValue
.
Note: The hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs.
Declaration
var
hashValue
:
Int
{
get
}
Access the underlying raw memory, getting and setting values.
Declaration
var
memory
:
Memory
{
get
set
}
Subscripts
Declaration
subscript
(
i
:
Int
) -
>
Memory
{
get
nonmutating
set
}
Static Methods
Allocate memory for num
objects of type Memory
.
Postcondition: The memory is allocated, but not initialized.
Declaration
static
func
alloc
(
num
:
Int
) -
>
UnsafeMutablePointer
<
Memory
>
Instance Methods
Declaration
func
advancedBy
(
n
:
Int
) -
>
UnsafeMutablePointer
<
Memory
>
Declared In
UnsafeMutablePointer
, RandomAccessIndexType
, BidirectionalIndexType
, _RandomAccessAmbiguity
, ForwardIndexType
Declaration
func
advancedBy
(
n
:
UnsafeMutablePointer
<
Memory
>
.
Distance
,
limit
:
UnsafeMutablePointer
<
Memory
>
) -
>
UnsafeMutablePointer
<
Memory
>
Declared In
RandomAccessIndexType
, BidirectionalIndexType
, ForwardIndexType
Assign from count
values beginning at source
into
initialized memory, proceeding from the last value to the first.
Use this for assigning ranges into later memory that may overlap
with the source range.
Requires: Either source
precedes self
or follows self + count
.
Declaration
func
assignBackwardFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Assign from count
values beginning at source into initialized
memory, proceeding from the first element to the last.
Declaration
func
assignFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Deallocate num
objects.
num
: Number of objects to deallocate. Should match exactly
the value that was passed to alloc()
(partial deallocations are not
possible).
Precondition: The memory is not initialized.
Postcondition: The memory has been deallocated.
Declaration
func
dealloc
(
num
:
Int
)
Destroy the object the pointer points to.
Precondition: The memory is initialized.
Postcondition: The value has been destroyed and the memory must be initialized before being used again.
Declaration
func
destroy
()
Destroy the count
objects the pointer points to.
Precondition: The memory is initialized.
Postcondition: The value has been destroyed and the memory must be initialized before being used again.
Declaration
func
destroy
(
count
:
Int
)
Declaration
func
distanceTo
(
x
:
UnsafeMutablePointer
<
Memory
>
) -
>
Int
Declared In
UnsafeMutablePointer
, RandomAccessIndexType
, BidirectionalIndexType
, ForwardIndexType
Initialize the value the pointer points to, to construct an object where there was no object previously stored.
Precondition: The memory is not initialized.
Postcondition: The memory is initalized; the value should eventually be destroyed or moved from to avoid leaks.
Declaration
func
initialize
(
newvalue
:
Memory
)
Copy the elements of C
into raw memory.
Precondition: The memory is not initialized.
Declaration
func
initializeFrom
<
C
:
CollectionType
where
C
.
Generator
.
Element
==
Memory
>
(
source
:
C
)
Copy count
values beginning at source into raw memory.
Precondition: The memory is not initialized.
Requires: self
and source
may not overlap.
Declaration
func
initializeFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Retrieve the value the pointer points to, moving it away from the location referenced in memory.
Equivalent to reading memory
property and calling destroy()
,
but more efficient.
Precondition: The memory is initialized.
Postcondition: The value has been destroyed and the memory must be initialized before being used again.
Declaration
func
move
() -
>
Memory
Assign from count
values beginning at source
into initialized
memory, transforming the source values into raw memory.
Requires: The self
and source
ranges may not overlap.
Declaration
func
moveAssignFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Move count
values beginning at source
into uninitialized memory,
transforming the source values into raw memory, proceeding from
the last value to the first. Use this for copying ranges into
later memory that may overlap with the source range.
Requires: Either source
precedes self
or follows self + count
.
Declaration
func
moveInitializeBackwardFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Move count
values beginning at source into raw memory,
transforming the source values into raw memory.
Declaration
func
moveInitializeFrom
(
source
:
UnsafeMutablePointer
<
Memory
>
,
count
:
Int
)
Returns the previous consecutive value before self
.
Requires: The previous value is representable.
Declaration
func
predecessor
() -
>
UnsafeMutablePointer
<
Memory
>
Return the sequence of values (start
, start + stride
, start +
stride + stride
, ... last) where last is the last value in
the progression less than or equal to end
.
Note: There is no guarantee that end
is an element of the sequence.
Declaration
func
stride
(
through
end
:
UnsafeMutablePointer
<
Memory
>
,
by
stride
:
UnsafeMutablePointer
<
Memory
>
.
Stride
) -
>
StrideThrough
<
UnsafeMutablePointer
<
Memory
>
>
Declared In
RandomAccessIndexType
, Strideable
Return the sequence of values (self
, self + stride
, self +
stride + stride
, ... last) where last is the last value in
the progression that is less than end
.
Declaration
func
stride
(
to
end
:
UnsafeMutablePointer
<
Memory
>
,
by
stride
:
UnsafeMutablePointer
<
Memory
>
.
Stride
) -
>
StrideTo
<
UnsafeMutablePointer
<
Memory
>
>
Declared In
RandomAccessIndexType
, Strideable
Returns the next consecutive value after self
.
Requires: The next value is representable.
Declaration
func
successor
() -
>
UnsafeMutablePointer
<
Memory
>
3 inherited items hidden. (Show all)
A pointer to an object of type
Memory
. This type provides no automated memory management, and therefore the user must take care to allocate and free memory appropriately.The pointer should be aligned to
alignof(Memory.self)
.The pointer can be in one of the following states:
memory is not allocated (for example, pointer is null, or memory has been deallocated previously);
memory is allocated, but value has not been initialized;
memory is allocated and value is initialized.