[swift-users] array.first vs. array[0]

David Turnbull dturnbull at gmail.com
Thu Jan 21 15:43:27 CST 2016


The documentation is correct. Thinking about key lookups as O(1) is what
led to this problem...
http://www.ocert.org/advisories/ocert-2011-003.html

-david

On Thu, Jan 21, 2016 at 1:36 PM, Dave Abrahams <dabrahams at apple.com> wrote:

>
> on Thu Jan 21 2016, David Turnbull <dturnbull-AT-gmail.com> wrote:
>
> > On Thu, Jan 21, 2016 at 12:23 PM, Dave Abrahams via swift-users <
> > swift-users at swift.org> wrote:
> >
> >> Swift Dictionaries are documented as having O(1) lookup.
> >>
> >
> > Only the lookup by index is O(1). Lookup by key is not specified.
>
> Then that's a bug in our documentation; please file a ticket!  It should
> guarantee O(1) as long as the Dictionary isn't backed by NSDictionary
> and the hash function is good.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160121/9da410b7/attachment.html>


More information about the swift-users mailing list