Skip to content

Instantly share code, notes, and snippets.

@Drunkar
Last active August 4, 2016 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drunkar/7905475 to your computer and use it in GitHub Desktop.
Save Drunkar/7905475 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
struct Larger {
bool operator() (int a, int b) {
return a < b;
}
};
typedef std::priority_queue<int, std::vector<int>, Larger> rpqueue;
int main() {
rpqueue rpq;
rpq.push(3);
rpq.push(1);
rpq.push(2);
while(pq.size() > 0) {
cout << rpq.top() << endl;
rpq.pop();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment