Stores the given value’s bytes into raw memory at the specified offset.
- Xcode 8.0+
- Swift Standard Library
The value to store as raw bytes.
The offset from this pointer, in bytes.
offsetmust be nonnegative. The default is zero.
The type of
T to be stored must be a trivial type. The memory at this pointer plus
offset must be properly aligned for accessing
T. The memory must also be uninitialized, initialized to
T, or initialized to another trivial type that is layout compatible with
store, the memory is initialized to the raw bytes of
value. If the memory is bound to a type
U that is layout compatible with
T, then it contains a value of type
store does not change the bound type of the memory.
If you need to store a copy of a nontrivial value into memory, or to store a value into memory that contains a nontrivial value, you cannot use the
store method. Instead, you must know the type of value previously in memory and initialize or assign the memory. For example, to replace a value stored in a raw pointer
U is the current type and
T is the new type, use a typed pointer to access and deinitialize the current value before initializing the memory with a new value.