Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use C++ STL containers in My iPhone App?

I'd like to use an STL set in my iPhone app (which is written in Objective-C in XCode). How do I include set and/or use the standard namespace?

In C++ I'd do this:

#include<set>
using namespace std;

// use the set<T> somewhere down here...

How can I do this in Objective-C?

like image 453
MrDatabase Avatar asked May 05 '09 02:05

MrDatabase


1 Answers

Just rename your source file so it ends in .mm and it should trigger the Objective-C++ front-end; you can then mix Objective-C and C++ in it. More information here.

like image 73
Nicholas Riley Avatar answered Oct 13 '22 18:10

Nicholas Riley