vector<string> text{"hello world"};
for(auto it = text.begin(); it != text.end() && ! it->empty(); ++it)
{
*it = toupper(*it);
cout<< *it << endl;
}
这里有个问题,toupper()只接受int的参数,而vector的基础元素是string所以无法使用,有没有办法在循环中使用toupper()
第二:当我将text的类型改为string时,循环的判断条件 ! it->empty() 编译器显示表达式应该包含指向类型的指针,why??难道string不是一个类型吗,string不是标准库类型吗??