<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="">+1. &nbsp;I haven’t found use for it, and I don’t think there is one outside of stdlib.</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 10, 2016, at 6:12 PM, Erik Eckstein via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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&lt;MyHeader, MyElements&gt; {</font></div><div class=""><font face="Menlo" class="">&nbsp; deinit {</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; // do whatever needs to be done</font></div><div class=""><font face="Menlo" class="">&nbsp; }</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&nbsp;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></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>