【发布时间】:2011-08-28 16:25:58
【问题描述】:
我希望在下面的示例中编译器将无法编译代码,因为它 不知道什么是“find()”,它定义在 algorithm 标头中的 std 命名空间中。
但是,此代码在 RHEL 5.3 上使用 gcc 4.1.2 编译。
我错过了什么?
#include <string>
#include <algorithm>
int main()
{
std::string s;
find(s.begin(), s.end(), 'a'); // should not compile
}
【问题讨论】:
-
@Nick:两者都不是。请参阅下面的答案。
标签: c++ stl namespaces