私は.
C++で文字列を分割しようとしています。次に、分割された最初の文字列を受け入れる別のメソッドに渡す必要がありますconst char* key
..しかし、そうするたびに、常に例外が発生します-
以下は私のコードです -
istringstream iss(key);
std::vector<std::string> tokens;
std::string token;
while (std::getline(iss, token, '.')) {
if (!token.empty()) {
tokens.push_back(token);
}
}
cout<<"First Splitted String: " <<tokens[0] << endl;
attr_map.upsert(tokens[0]); //this throws an exception
}
以下は、AttributeMap.hh ファイルの upsert メソッドです。
bool upsert(const char* key);
そして、以下は私がいつも得る例外です-
no matching function for call to AttributeMap::upsert(std::basic_string<char>&)
不足しているものはありますか?