What is missing to replace C with Swift?

Placement new is, effectively, supported in Swift. What isn't supported is direct storage of reference-counted objects. Compare:

auto buf = reinterpret_cast<std::string *>(std::calloc(...));
new (buf) std::string("Hello world!");
let buf = UnsafeMutablePointer<String>.allocate(capacity: 1)
buf.initialize(to: "Hello world!")
1 Like