Does the iOS SDK provide queues and stacks?

后端 未结 8 1834
情话喂你
情话喂你 2021-02-02 08:05

I\'m writing an iPhone app, and I\'m surprised that there seem to be no NSQueue or NSStack classes in Apple\'s Foundation Framework. I see that it would be quite easy to roll m

8条回答
  •  萌比男神i
    2021-02-02 08:17

    No. You missed nothing. That's all. Objective-C is higher level language look like C. Low level control is not required.

    Cocoa classes are designed for easier use than efficiency. If you want to deal with performance, you have an option of raw C (or C++) implementation. Otherwise, just use easy way. Of course, early-optimization is evil.

    If you want a kind of encapsulation, just make a new class which contains NSMutableArray within it. Hide inner NSMutableArray and just expose what you want. But you'll realize this is unnecessary.

提交回复
热议问题