Sorting a vector of objects in C++

后端 未结 8 1253
慢半拍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:44

    Is sortingVector a non-static member of some class? The error message suggests that it is, in which case you will need to wrap it (using boost::bind, for example) into a binary operation that doesn't take a this parameter. You might want to make sortingVector a static member or a free function instead.

提交回复
热议问题