#include #include #include #include #include using namespace std; // here's the functor definition of the comparison operator class sizesortT { public: bool operator()(const string s1, const string s2) const { return s1.length() words; while(!f.eof()) { string w; f >> w; words.push_back(w); } //sort(begin(words),end(words)); // sort w/ standard cmp //sort(begin(words),end(words),sizesortT()); // sort w/ new cmp as functor //sort(begin(words),end(words),sizesortfn); // sort w/ new cmp as function int cmpcount =0; // sort with new cmp as lambda (and a counter for # of cmps needed) /* sort(begin(words),end(words), [&cmpcount](const string s1, const string s2) { cmpcount++; return s1.length()