I want to use a queue data structure in my Objective-C program. In C++ I’d use the STL queue. What is the equivalent data structure in Objective-C? How do I push/pop items?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ben’s version is a stack instead of a queue, so i tweaked it a bit:
NSMutableArray+QueueAdditions.h
NSMutableArray+QueueAdditions.m
Just import the .h file wherever you want to use your new methods, and call them like you would any other NSMutableArray methods.