【发布时间】:2011-07-04 20:55:35
【问题描述】:
另一个关于STL的小问题:
我有字典:
map <string,vector <Wordy> > Dictionary;
使用结构 Wordy:
struct Wordy{ int count; string word;}
这个结构也有重载的操作符
bool operator< (Wordy& One, Wordy& Two){return One.count<Two.count;}
但是算法中的这个 sort() 函数不起作用!
sort(Dictionary.find(s)->second.begin(),Dictionary.find(s)->second.end());
【问题讨论】:
-
@Martin:OP 没有对地图进行排序,她正在对地图的特定 元素 进行排序。