Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <iostream>
- class IntOrder{
- public:
- bool operator() (int a, int b) const {return o[a%o.size()]<o[b%o.size()];}
- protected:
- std::vector<int> o = {0,2,4,6,8};
- };
- class Foo{
- public:
- Foo(IntOrder o, std::vector<int> ints){
- this->o = o;
- for(auto i:ints)
- h.push(i);
- }
- protected:
- IntOrder o;
- std::priority_queue<int, std::vector<int>, IntOrder> h;
- };
- int main() {
- std::vector<int> ints = {0,1,2,3,4,5,6,7,8,9};
- auto foo = new Foo(IntOrder(), ints);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement