Struct and class

false. my post in this thread explains more

not the main, but a significant argument

okay let’s clear things up, you can totally put structs in the heap. just allocate(capacity:) space for it in memory and initialize it. swift native Arrays are also heap buffers (actually they use a weird tail-allocation thing where the array’s own metadata is stored in the same buffer) and if Element is a struct, it will be stored in the heap

you’re probably thinking of protocol type containers. completely different animal

??

i’m sure Swift is smart enough to do lvalue assigments in place, and internal structs are transparent to the compiler so i’d be shocked it it wasn’t smart enough to put the relevant pieces of structs into registers and only write to them in memory when necessary

the important word in the sentence “mutation is modeled as copyback assignment” is “modeled”.

this is correct.

you’re confusing swift’s c interop with withUnsafeMutableBufferPointer (although they do similar things)