Sorting a vector of objects in C++

后端 未结 8 1256
慢半拍i
慢半拍i 2021-01-28 13:26
struct Keyword
{
    std::string keyword;
    int numUses;
};  

bool sortingVector(const Keyword& key1, const Keyword& key2)
{
    return key1.numUses < key2         


        
8条回答
  •  孤街浪徒
    2021-01-28 13:40

    You probably want to call std::sort instead of plain sort and might have to include the appropriate header file (algorithmunless I'm mistaken).

提交回复
热议问题