不能将参数 1 从“int &(__thiscall RBTree<T>::* )(RBTreeNode<T> *)”转换为“int &(__cdecl *)(RBTreeNode<T> *)”
2014-06-16 11:25
381 查看
因为你需要的是一个类的函数地址而不是对象的。所以必需用静态成员函数。
或者友元也可以吧???
thiscall仅仅应用于“C++”成员函数。this指针存放于CX/ECX寄存器中,参数从右到左压。thiscall不是关键词,因此不能被程序员指定。
__cdecl
C调用约定(即用__cdecl关键字说明)(The C default calling convention)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参数vararg的函数(如printf)只能使用该调用约定)。另外,在函数名修饰约定方面也有所不同。 _cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。VC将函数编译后会在函数名前面加上下划线前缀。
声明的话直接像下面这样就行了
C/C++ code
?
static
int
implement(
int
x);
//改成静态成员函数
或者友元也可以吧???
thiscall仅仅应用于“C++”成员函数。this指针存放于CX/ECX寄存器中,参数从右到左压。thiscall不是关键词,因此不能被程序员指定。
__cdecl
C调用约定(即用__cdecl关键字说明)(The C default calling convention)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参数vararg的函数(如printf)只能使用该调用约定)。另外,在函数名修饰约定方面也有所不同。 _cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调用_stdcall函数的大。函数采用从右到左的压栈方式。VC将函数编译后会在函数名前面加上下划线前缀。
声明的话直接像下面这样就行了
C/C++ code
?
相关文章推荐
- C++ error C2662: “LinkNode<T> *List<T>::Locate(int)”: 不能将“this”指针从“const List<int>”转换为“List<int> &”
- 不能将参数 1 从“int”转换为“std::_Vector_const_iterator<_Myvec>”(VS2010 )
- 错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall chain<int>::~chain<int>(void)" (??1?$chain@H@@QAE@
- LNK2019: 无法解析的外部符号 "public: void __thiscall List<int>::add(int const &)" (?add@?$List@H@@QAEXABH@Z),
- 解决“error C2664:不能将参数 从“<某某>*__w64 ”转换为“<某某>**”的
- error C2664: “ATL::CStringT<BaseType,StringTraits>::Remove”: 不能将参数 1 从“const char [2]”转换为“char”
- vector<int> 转换为 int*
- error C2662: 不能将“this”指针从“const Node_align”转换为“Node_align &”解决方案
- error C2664: “BOOL CDC::TextOutW(int,int,const CString &)”: 不能将参数 3 从“const char [18]”转换为“const CString &”
- hdu 4941 stl的map<node,int>用法
- list<string>转换成list<int>类型
- error C2664: “ATL::CStringT<BaseType,StringTraits>::Remove”: 不能将参数 1 从“const char [2]”转换为“char”
- error C2664: “××函数”: 不能将参数 2 从“char *”转换为“LPCWSTR” 1> 与指向的类型无关;转换要求
- List<?>不能直接被类型转换
- error LNK2001: unresolved external symbol "public: int __thiscall CFtProtocolThread::getFnIds(class _STL::vector > &)" (?getFnId
- 3.关于VS2008 中的pDC->TextOut 参数转换问题 <Unicode Character>
- error LNK2001: unresolved external symbol "public: int __thiscall A<int>::get(void)" (?get@?$A@H@@QAEHXZ)
- C# 转换 char <==> int is as Random @
- 基类代码error C2662: 不能将“this”指针从“const Node_align”转换为“Node_align &”解决方案
- 无法确定 <T>T 的类型参数 ;对于上限为int,java.lang.Object 的类型变量 T,不存在唯一最大实例