Error using std::sort with item class

I’m getting the following error when trying to sort a std::pair using a predicate. Could someone shed some light on why I’m getting this? My research on this error hasn’t come up with anything helpful.

error: no matching function for call to ‘sort(std::vector<std::pair<item*, int> >::iterator, std::vector<std::pair<item*, int> >::iterator, item::add_ammo_to_quiver(player*, bool)::sort_by_charges)’

std::vector<std::pair<item*, int> > quivers; //stores quiver item and its max charges //sort quivers by contents, such that empty quivers go last struct sort_by_charges { bool operator()(const std::pair<item*,int> &left, const std::pair<item*,int> &right) { if(left.first->contents.empty()) { return true; } else if (right.first->contents.empty()){ return false; } else { return left.first->contents[0].charges < right.first->contents[0].charges; } } }; std::sort(quivers.begin(), quivers.end(), sort_by_charges());

EDIT: Here’s the PR, if you want some context.

Nevermind, I figured it out. I had to move the struct definition outside of the function (will probably throw it in items.h).