<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">The purpose of ManagedBufferPointer is to create a buffer with a custom class-metadata to be able to implement a custom deinit (e.g. to destroy the tail allocated elements).</div><div class="">It was used in Array (before I replaced it with the new tail-allocated-array-built-ins). But now it’s not used anymore in the standard library.</div><div class=""><br class=""></div><div class="">As a replacement for ManagedBufferPointer one can just derive a class from ManagedBuffer and implement the deinit in the derived class.</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">final class MyBuffer : ManagedBuffer<MyHeader, MyElements> {</font></div><div class=""><font face="Menlo" class=""> deinit {</font></div><div class=""><font face="Menlo" class=""> // do whatever needs to be done</font></div><div class=""><font face="Menlo" class=""> }</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">// creating MyBuffer:</font></div><div class=""><font face="Menlo" class="">let b = MyBuffer.create(minimumCapacity: 27, makingHeaderWith: { myb in return MyHeader(...) })</font></div><div class=""><br class=""></div></div><div class="">IMO ManagedBuffer is much cleaner than ManagedBufferPointer (it doesn’t need this custom bufferClass to be passed to the constructor). Also ManagedBufferPointer doesn’t use SIL tail-allocated arrays internally. Although this is not something visible to the programmer, it makes life easier for the compiler.</div><div class=""><br class=""></div><div class="">So I suggest that we deprecate ManagedBufferPointer.</div><div class=""><br class=""></div><div class="">Erik</div></body></html>