How to know if a value type includes heap allocations and ref counting

The question you're asking for is if a type is trivially copyable and destroyable, which in practice is the case iff the type does not contain any reference types or existentials. There's an _isPOD() (Warning: underscored API!) entry point in the stdlib for this purpose:

print(_isPOD(Int.self)) // true
print(_isPOD(Array<Int>.self)) // false
27 Likes