Build problems when adding `__str__` method to Boost Python C++ class

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:18:15

I recently encountered this problem; The solution that worked was to explicitly resolve the str and self on this line:

.def(str(self))

So that it becomes:

.def(self_ns::str(self_ns::self))

I don't know why this is necessary, (knowing something of the overload-resolution complication that goes on in boost python, it's probably something there...) but it worked for me :)

I ran into the same thing. Adding this line (instead of qualifying str and self) also works:

using self_ns::str;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!