Skip to content

Instantly share code, notes, and snippets.

View vakhidbetrakhmadov's full-sized avatar

Vakhid Betrakhmadov vakhidbetrakhmadov

View GitHub Profile
@vakhidbetrakhmadov
vakhidbetrakhmadov / MemoryAddress.swift
Created January 14, 2020 20:35 — forked from nyg/MemoryAddress.swift
Get the memory address of both class and structure instances in Swift.
// https://stackoverflow.com/a/45777692/5536516
import Foundation
struct MemoryAddress<T>: CustomStringConvertible {
let intValue: Int
var description: String {
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size