[ create a new paste ] login | about

Link: http://codepad.org/g3AvnAlL    [ raw code | output | fork ]

C++, pasted on May 30:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <queue>
#include <vector>
#include <functional>

struct S
{
    int i;
};

bool Compare(S lhs, S rhs) { return lhs.i < rhs.i; }

int main()
{
        typedef std::priority_queue<S, std::vector<S>, bool(*)(S,S)> queue_t;
        queue_t queue(Compare);
        std::bind1st(std::mem_fun(&queue_t::push), &queue);
        return 0;
}


Output:
1
2
3
4
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: In instantiation of 'std::binder1st<std::mem_fun1_t<void, std::priority_queue<S, __gnu_debug_def::vector<S, std::allocator<S> >, bool (*)(S, S)>, const S&> >':
t.cpp:18:   instantiated from here
Line 404: error: forming reference to reference type 'const S&'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: