|
|
|
|
|
by tarentel
1600 days ago
|
|
> The biggest semantic impedance mismatch between C++ classes and Swift classes is that Swift classes are reference-counted. It is certainly possible to import a C++ class as a Swift class if it is intrusively reference counted, or wrapped in a shared_ptr. > But what about non-movable C++ classes that are not reference counted? This issue could be worked around by making retain and release operations on C++ classes be a no-op, and introducing an explicit "delete" operation, effectively making C++ class references in Swift equivalent to UnsafeMutablePointer. There's some information about it in https://github.com/apple/swift/blob/main/docs/CppInteroperab... this is quite long though so there's likely a lot more information. This quote is apparently just one strategy they're considering? At least that's my take on reading it. |
|