【发布时间】:2011-10-03 06:42:00
【问题描述】:
这是为什么?
transform(theWord.begin(), theWord.end(), theWord.begin(), std::tolower); - 不起作用
transform(theWord.begin(), theWord.end(), theWord.begin(), tolower); - 不起作用
但是
transform(theWord.begin(), theWord.end(), theWord.begin(), ::tolower); - 确实有效
theWord 是一个字符串。我是using namespace std;
为什么它可以使用前缀 :: 而不是 std:: 或什么都没有?
感谢您的帮助。
【问题讨论】:
-
你包含哪些头文件?
-
#include <cstdlib> #include <fstream> #include <iterator> #include <algorithm> #include <cctype> #include <vector> #include <sstream>
标签: c++ namespaces name-decoration