的載體時,我有class Passanger
有變量string name; string station; string ticket;
,然後我有另一個和這個類中我有vector<Passanger*> myQueue;
使用stable_sort,分選物體
現在我想用stable_sort
排序myQueue
。有沒有什麼可能,怎麼說到stable_sort
,應該是什麼關鍵,按照它要排序myQueue
?
std::stable_sort(myQueue.begin(),myQueue.end(), maybeSomethingElse());
?
函數在這種情況下將以相同的方式代替函數對象。 –