Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created October 2, 2015 13:42
Show Gist options
  • Select an option

  • Save toshi0383/1d13a89c3bb36dae9c14 to your computer and use it in GitHub Desktop.

Select an option

Save toshi0383/1d13a89c3bb36dae9c14 to your computer and use it in GitHub Desktop.
/// 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.
public struct UnsafeMutablePointer<Memory> : Equatable, Hashable, NilLiteralConvertible, _PointerType, BidirectionalIndexType, ForwardIndexType, _Incrementable, RandomAccessIndexType, Strideable, Comparable, _Strideable, _RandomAccessAmbiguity {
~~~中略~~~
/// Allocate memory for `num` objects of type `Memory`.
///
/// - Postcondition: The memory is allocated, but not initialized.
@warn_unused_result
public static func alloc(num: Int) -> UnsafeMutablePointer<Memory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment