[swift-evolution] removeFirst, optional equiviliant
Dave Abrahams
dabrahams at apple.com
Wed Jan 6 18:09:05 CST 2016
> On Jan 6, 2016, at 3:48 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
>
> Whoops, I meant append()/popFirst. That is, even for a single-ended queue, you'll use one "first" operation (less efficient) and one "last" operation.
No, a single-ended queue is a stack. You can use append and popLast on Array for that.
>
> On Wed, Jan 6, 2016 at 3:47 PM, Dave Abrahams <dabrahams at apple.com <mailto:dabrahams at apple.com>> wrote:
>
>> On Jan 6, 2016, at 3:42 PM, Jacob Bandes-Storch <jtbandes at gmail.com <mailto:jtbandes at gmail.com>> wrote:
>>
>> Oops, I forgot this existed.
>>
>> I'm assuming you're recommending popLast for performance reasons? Unfortunately, for a
>
> …double-ended…
>
>> queue, you'll need either insertAtIndex(0)/popLast or append()/popLast (or a different data structure)…
>
> Yes, the standard library should acquire a Deque data structure at some point.
>
> Is there a SR for this?
Not that I know of; have at it!
-Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160106/3e235e23/attachment.html>
More information about the swift-evolution
mailing list