所以我见过很多类似的问题,但没有答案正在解决我的问题。有人可以解释为什么这代码:简单变换tolower不工作
string LinkedListByName::toLower(string stringToConvert){
return std::transform(stringToConvert.begin(), stringToConvert.end(), stringToConvert.begin(), ::tolower); }
是给我这个错误:
conversion from `__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' to non-scalar type `std::string' requested
在项目中,我将需要转换大量的字符串,以降低和提升的是不是一种选择。我从字面上复制并粘贴了以前项目中的代码。
此外,该头文件包括以下内容:
#include <vector>
using namespace std;
#include <iostream>
using namespace std;
#include <string>
using namespace std;
#include <algorithm>
#include "Node.h"
namespace model {
'使用命名空间std;'是一个坏主意,在几乎所有的时间,但是这肯定是我第一次看到它在一排... – us2012 2013-02-24 02:07:50