Does swift copy on write for all structs?
Array is implemented with copy-on-write behaviour – you’ll get it regardless of any compiler optimisations (although of course, optimisations can decrease the number of cases where a copy needs to happen). At a basic level, Array is just a structure that holds a reference to a heap-allocated buffer containing the elements – therefore multiple Array … Read more