gpt4 book ai didi

c++ - SWIG C++ 到 Python : Warning(362): operator= ignored

转载 作者:太空狗 更新时间:2023-10-29 18:24:40 38 4
gpt4 key购买 nike

我正在将 C++ 类导出到 Python,我注意到在编译期间,SWIG 发出了以下警告:

Warning(362): operator= ignored

我不确定为什么运算符会重载,因为它在 SWIG documentation 中说,SWIG 能够处理赋值运算符等运算符

我的类没有什么特别之处,它是这样声明的:

class Foo
{
public:
Foo();
Foo& operator= (const Foo&);
// etc ..
};

为什么 SWIG 无法为赋值运算符生成包装代码,我该如何解决这个问题?

最佳答案

python 中没有赋值(原始类型除外),只有指针赋值。如果你想创建一个拷贝,你需要一个特殊的复制功能。

关于c++ - SWIG C++ 到 Python : Warning(362): operator= ignored,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8102244/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com