enum
MemoryLayout
<
T
>
Import |
|
---|
Static Variables
The contiguous memory footprint of T
.
Does not include any dynamically-allocated or "remote" storage. In
particular, MemoryLayout<T>.size
, when T
is a class type, is the same
regardless of how many stored properties T
has.
Declaration
static
var
size
:
Int
{
get
}
The number of bytes from the start of one instance of T
to the start of
the next in an Array<T>
.
This is the same as the number of bytes moved when an UnsafePointer<T>
is incremented. T
may have a lower minimal alignment that trades runtime
performance for space efficiency. The result is always positive.
Declaration
static
var
stride
:
Int
{
get
}
Static Methods
Returns the contiguous memory footprint of T
.
Does not include any dynamically-allocated or "remote" storage. In
particular, MemoryLayout.size(ofValue: x)
, when x
is a class instance,
is the same regardless of how many stored properties T
has.
Declaration
static
func
size
(
ofValue
_
:
T
) -
>
Int
Returns the number of bytes from the start of one instance of T
to the
start of the next in an Array<T>
.
This is the same as the number of bytes moved when an UnsafePointer<T>
is incremented. T
may have a lower minimal alignment that trades runtime
performance for space efficiency. The result is always positive.
Declaration
static
func
stride
(
ofValue
_
:
T
) -
>
Int
The memory layout of a type, describing its size, stride, and alignment.