Given an instance of UnsafeMutablePointer
, what\'s the point of calling deinitialize(count:)
right before deallocate(capacity:)
?
The article explains below the code, if you keep reading.
Update: as noted by user atrick in the comments below, deinitialization is only required for non-trivial types. That said, including deinitialization is a good way to future proof your code in case you change to something non-trivial. Also, it usually doesn’t cost anything since the compiler will optimize it out.