b*********n 发帖数: 1258 | 1 想写一个functor来比较2个pair的大小,但是compile有错误, Code Below
===========================================================
error C2664: 'void __cdecl std::sort(struct std::pair *,stru
ct std::pair *,bool (__thiscall *)(struct std::pair
le>,struct std::pair))'
ruct std::pair)' to 'bool (__thiscall *)(struct std::pair
t,double>,struct std::pair)'
None of the functions with this name in scope match the target t
ype
Error executing cl | o**********c 发帖数: 6 | 2 把bool mysortfn ()变成 static bool mysortfn ()就可以了。因为你原来的函数是
member function, sort() requires common function.
you must be using visual c++, all member functions are __thiscall convention
, where ecx is used to transfer the this pointer. however, sort() requires _
_cdecl convention. |
|