所以我見過很多類似的問題,但沒有答案正在解決我的問題。有人可以解釋爲什麼這代碼:簡單變換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