I apologise if that's my search skills that failed me, but I nevertheless couldn't find a direct explanation why one can't manually allocate class instances, so I would like to ask it here.
Basically, sometimes one wants to manually allocate storage for better cache hits and so on, but AFAIK, in Swift, it's only possible to do this with structs via pointer or
ManagedBuffer APIs. Attempting to do it with classes would instead store a buffer of essentially pointers instead of the actual storage. Is it possible to eventually have such mechanism for class instances too? Or is it already there, and it's just me not knowing about it?
From my understanding, class storage sometimes does get inlined (if an instance does not outlive a function's scope, for example), but otherwise from what I know, class instances are allocated by the runtime by using the C++'s
new operator. Is it ARC that prohibits other mechanisms? Can one hope to eventually have a type akin to
Unmanaged<T> that would allow the use custom allocators for class storage?