int TFIDFMeasure::CountWords(string& word, const StrVec& words) { int nCount = 0; nCount = count_if(words.begin(),words.end(),WordComp(word)); return nCount; } class WordComp { public: WordComp(string& sWord) : word(sWord) { } bool operator() (const string& lhs) { return lhs.compare(word)==0; } private: string word; };