I need a stack ADT in my application. I would like to avoid making a wrapper on NSMutableArray
; there must be an efficient implementation in Foundation somewhere.
So, how do I access it?
You've got a couple of options; if you really want a stack, you could use std::stack
from STL. Just be sure to include #import <stack>
rename any .m
files which use it to .mm
.
The other option is to write an Objective-C class which either wraps std::stack
, or provides a stack interface to NSMutableArray
. I include this despite your wishes to the contrary, because unless you have actually profiled the code that uses NSMutableArray
, you have absolutely no business complaining about its performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With