Stuck by another problem about the vector, map functions
the topnwords function is to find the top n times words occurrence
Here is my code:
//stringvector is the type--
//typedef vector< pair < string, int > > StringIntVector;
StringIntVector TextUtil::topNWords(size_t n) const
{
map<string, int> freq;
for(size_t i=0; i<_word_list.size(); i++)
{
if(isnotpuct())
{
string words = _word_list[i];
size_t topn = wordCount(words);
freq[words] = topn;
}
}
sort(freq.begin(),freq.end());
map<string, int>::const_iterator iter;
for (iter=freq.begin(); iter != freq.end(); iter++)
{
return(iter->first,iter->second);
}
}
So i got this error:
Error 1 error C2664: 'std::vector<_Ty>::vector(const std::vector<_Ty> &)' : cannot convert parameter 1 from 'const int' to 'const std::vector<_Ty> &'
Many thanks.