最初我在while循環中寫了std::istringstream iss(std::move(string));
,所以在內部循環中給出了錯誤crosses initialization
。現在它不在任何循環中,但它也會給出錯誤crosses the initialization
。std :: istringstream iss(std :: move(string));穿過初始化雖然它是在外側循環
void *SocketHandler(void *lp)
{
typedef std::unordered_map<std::string,int> occurrences;
occurrences s1;
std::string ss;
std::ostringstream bfr;
std::string result_string;
std::vector<std::string> most;
int max_count = 0;
int tmp=0;
while ((NULL != word) && (50 > i)) {
ch[i] = strdup(word);
excluded_string[j]=strdup(word);
word = strtok(NULL, " ");
skp = BoyerMoore_skip(ch[i], strlen(ch[i]));
bfr << excluded_string[j] << " ";
result_string = bfr.str();
j++;
// std::cout << "string is :" << r1;
i++;
if(str==NULL && str==NULL and skp !=NULL)
{
pcount=0;
ncount=0;
}
}
std::cout << "string is :" << result_string << "\n";
std::istringstream iss(std::move(result_string)); // **Here it gives error**
while (iss >> result_string)
{
tmp = ++s1[result_string];
if (tmp == max_count)
{
most.push_back(result_string);
}
else if (tmp > max_count)
{
max_count = tmp;
most.clear();
most.push_back(result_string);
}
}
std::cout << std::endl << "Maximum Occurrences" << std::endl;
for (std::vector<std::string>::const_iterator it = most.cbegin(); it != most.cend(); ++it)
std::cout << *it << std::endl;
return 0;
}
這是在一個開關的情況下? – chris
@chris:沒有沒有在開關 – user123
@卡里姆汗,哦,錯誤的措辭讓我想起了那個問題。 – chris