gpt4 book ai didi

Objective-C 复杂度引用

转载 作者:太空狗 更新时间:2023-10-30 04:00:25 25 4
gpt4 key购买 nike

对于 c++ STL,有一个 de-facto standard location (除了 de-jour standard 之外,我的意思是)查找有关标准容器操作的复杂性保证的信息。

Is there an analogous, web-accessible document listing complexity guarantees for NSArray, NSDictionary, etc.?

例如,我找不到为 [NSArray count] 提供复杂性的引用

最佳答案

正确。没有一个。 C++/STL(基于我有限的理解)非常注重性能。 Objective-C/Foundation 基本上不会。

NSArray, NSDictionary 和 friend 是接口(interface)。它们告诉您如何使用它们,而不是它们的行为方式。这使他们可以出于性能原因自由切换引擎盖下的实现。关键是,您不需要关心,而且 API 中不会指定这一点,因此即使您想要也做不到 ;)

要真正了解这个主题,突出实现开关,并粗略比较基础类和 STL/C 数据结构,请查看 Ridiculous Fish(由 Apple AppKit 团队的某人撰写)blog post about "Our arrays, aren't"

关于Objective-C 复杂度引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9956422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com