如何摆脱 g++ hash_map 弃用警告?

发布于 2024-07-16 01:01:29 字数 287 浏览 5 评论 0 原文

当我编译我正在编写的使用 hash_map 的 C++ 应用程序时,我在 g++ 4.3.2 上收到此警告:

You are using the deprecated header 。 要消除此警告,请使用 ANSI 标准头文件或使用 hte -Wno-deprecated 编译器标志。

9> #include <ext/hash_map>

什么包括取代这个? 我在谷歌上搜索了一段时间,除了有类似问题的人之外找不到任何东西,但没有解决方案。

When I compile a c++ application I'm writing that makes use of hash_map, I get this warning on g++ 4.3.2:

You are using the deprecated header . To eliminate this warning, use an ANSI-standard header file or use hte -Wno-deprecated compiler flag.

9> #include <ext/hash_map>

What include replaces this? I've searched for a while on google, and can't find anything except for people having similar problems, but no solution.

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

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

发布评论

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

评论(3

祁梦 2024-07-23 01:01:29

我的第一个 Google 搜索结果为“g++ hash_map 已弃用 " 带我到一个页面,其中包含要处理的事项列表使用而不是已弃用的标头和类。

对于 hash_map,该列表建议使用 unordered_map,在 unordered_map 标头中。 该课程是 TR1 的新课程。

My very first Google hit for "g++ hash_map deprecated" takes me to a page that includes a list of things to use instead of the deprecated headers and classes.

For hash_map, the list suggests using unordered_map, in the unordered_map header. The class is new for TR1.

笑脸一如从前 2024-07-23 01:01:29

我相信这个新的数据结构被称为 unordered_map

<tr1/unordered_map>

位于 std::tr1 命名空间中。

I believe that that new data structure is called unordered_map

<tr1/unordered_map>

found in the std::tr1 namespace.

半寸时光 2024-07-23 01:01:29

当包含 时,不要忘记添加以下编译器选项; “-std=c++0x”,否则编译器会报错

When including , do not forget to add the following compiler option; "-std=c++0x", otherwise the compiler will report an error

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