如何在我的 iPhone 应用程序中使用 C++ STL 容器? [英] How do I use C++ STL containers in My iPhone App?
本文介绍了如何在我的 iPhone 应用程序中使用 C++ STL 容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的 iPhone 应用程序中使用 STL 集(在 XCode 中用 Objective-C 编写).如何包含设置和/或使用标准命名空间?
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?
在 C++ 中,我会这样做:
In C++ I'd do this:
#include<set>
using namespace std;
// use the set<T> somewhere down here...
我怎样才能在 Objective-C 中做到这一点?
How can I do this in Objective-C?
推荐答案
只需重命名您的源文件,使其以 .mm 结尾,它就会触发 Objective-C++ 前端;然后你可以在其中混合使用 Objective-C 和 C++.更多信息请此处.
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.
这篇关于如何在我的 iPhone 应用程序中使用 C++ STL 容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文