如何使用 C++ 我的 iPhone 应用程序中的 STL 容器?

发布于 2024-07-19 02:38:53 字数 267 浏览 3 评论 0原文

我想在我的 iPhone 应用程序中使用 STL 集(它是在 XCode 中用 Objective-C 编写的)。 如何包含设置和/或使用标准命名空间?

在 C++ 中我会这样做:

#include<set>
using namespace std;

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

How can I do this in 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?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绅刃 2024-07-26 02:38:53

只需重命名源文件,使其以 .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.

失退 2024-07-26 02:38:53

Objective-C 不直接支持 STL。 不过似乎有几个项目正在尝试将 STL 移植到 Objective-C。 Objectivelib 就是其中之一,可以在 sourceforge

STL is not directly supported in objective-C. There appear to be several projects though that are attempting to port STL to objective-C. Objectivelib is one such and is available on sourceforge

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文