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