#include #include struct Person { std::string name; int age; }; struct CompareByAge { bool operator()(const Person& p1, const Person& p2) const { return p1.age < p2.age; } }; int main() { std::priority_queue, CompareByAge> pq; pq.push({"Alice", 25}); pq.push({"Bob", 30}); pq.push({"Charlie", 20}); while (!pq.empty()) { std::cout << pq.top().name << " "; pq.pop(); } return 0; }