我期望在下面的例子中,编译器无法编译代码,因为它不知道什么是“find()”,而此函数在algorithm头文件的std命名空间中被定义。
然而,这段代码在使用gcc 4.1.2编译器时可以在RHEL 5.3上编译通过。
我错过了什么吗?
#include <string>
#include <algorithm>
int main()
{
std::string s;
find(s.begin(), s.end(), 'a'); // should not compile
}