为什么 std::greater 不再是 Visual Studio 2012 中 std 命名空间的一部分?我现在需要包括 <functional>
我认为 STL 库在不同工具集中保持相同
最佳答案
How come that std::greater is no more part of the std namespace in Visual Studio 2012?
如果是这样,我会感到非常惊讶。
I now need to include
<functional.h>
不,您需要包括 <functional>
因为这是定义所有标准函数对象的 header ,包括 greater
.
I thought STL libraries remained the same across toolsets
他们应该是。但是 header 允许包含其他 header ,因此有时您会发现即使您没有包含正确的 header 也可以使用某些东西。但是你不能依赖它,正如你在这里发现的那样。始终包括您使用的东西所需的所有 header 。
关于c++ - std::greater 未在 MSVC2012 中定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16567699/