C++,
pasted
on May 30:
|
#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:
|
/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.
|
|