Is there a Stack class in Objective-C that I can import and use?

I need an ADT stack in my application. I would like to avoid creating a wrapper on NSMutableArray ; there should be an effective implementation in Foundation.

So, how do I access it?

+6
source share
1 answer

You have several options; if you really need a stack, you can use std::stack from STL. Just include #import <stack> rename any .m files that use it in .mm .

Another option is to write an Objective-C class that either wraps std::stack or provides the NSMutableArray stack NSMutableArray . I include this, despite your wishes to the contrary, because if you really haven’t profiled the code that NSMutableArray uses, you have absolutely no business complaining about its performance.

+15
source

Source: https://habr.com/ru/post/886932/


All Articles