不能将参数 1 从“char”转换为“const std::basic_string<_Elem,_Traits,_Ax> &” 如何解决?

代码如下
在utility文件下报错:
error C2664: “std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::basic_string<_Elem,_Traits,_Ax> &)”: 不能将参数 1 从“char”转换为“const std::basic_string<_Elem,_Traits,_Ax> &”

int _tmain(int argc, _TCHAR* argv[])
{
ifstream ifs_str("F:/title.txt");
ofstream ofs_str("F:/out_title.txt");

hash_map<const int,vector<string>>map_1;
   vector<string>vec_1;
hash_map<string,set<int>>map_2;
   set<int>set_2;
   vector<string>vec_2;

   string str_line;
   while(getline(ifs_str,str_line)){     
   istringstream is_str(str_line);
   int k;
   string v;
   is_str>>k;
   is_str>>v;
   vec_1.push_back(v);
   map_1.insert(hash_map<int,vector<string>>::value_type(k,vec_1));
   }

  int i, j;
  for (i = 0; i <vec_1.size() ; i++) {
      for(j = 0;j < vec_1.size() ; j++)
      if (!map_1.count(vec_1[i][j])){
          for(hash_map<const int,vector<string>>::iterator it =map_1.begin(); it!= map_1.end();++it)
          set_2.insert(it->first);
       }
  map_2.insert(hash_map<string,set<int>>::value_type(vec_1[i][j],set_2));
  }

  for(hash_map<string,set<int>>::iterator it_1 =map_2.begin(); it_1 != map_2.end(); ++it_1){
       ofs_str<<it_1->first<<"\t"; 
     for(set<int>::iterator it_set = it_1->second.begin(); it_set != it_1->second.end(); ++it_set)
       ofs_str<<*it_set<<"\t";
  ofs_str<<endl;

}
ifs_str.close();
ofs_str.close();
}

c++
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!