Just swap the arguments given to your Comparator object:
auto cmp = [](auto a, auto b) { return Comparator()(b, a); };
std::priority_queue<int, std::vector<int>, decltype(cmp)> pq(cmp);
Note that your Comparator (i.e., the Compare in std::priority_queue) must provide strict weak ordering.
A Compare type providing a strict weak ordering.
However, the lambda expression
auto cmp = [](auto a, auto b) { return !Comparator()(a, b); };
may not provide a strict weak ordering. For example, if Comparator()(a, b) is defined to be a < b, then !Comparator()(a, b) would be equivalent to !(a < b), which is in turn equivalent to a >= b and definitely different from a > b.
Unlike the > operator, the >= operator is a binary relation1 that does not provide strict weak ordering because strictness2 does not hold, since it is true that a >= a, i.e., it is actually reflexive3.
(1) A binary relation is just a binary predicate, i.e., a boolean function taking two parameters, e.g., the relational operators or the operator() member function of std::less<int>.
(2) A binary relation it is said to be strict, if it never holds for an element and itself, e.g., <, since a < a never holds.
(3) A binary relation it is said to be reflexive, if it always holds for an element and itself, e.g., <=, since a <= a always holds.
!)pop()andtop()not the way it is supposed to behave for the given comparator?