从 std::function 创建 boost::python::object
如何从 std::function 构造 boost::python::object ?
How can I construct a boost::python::object from a std::function ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
boost:: python::make_function
,并提供签名,因为默认的签名不处理std::function
。例如,我们想要包装以下返回类型:
我们可以定义一个包装器并使用它的
def
:Python 端现在可以按照我们想要的方式使用结果:
Use
boost::python::make_function
, and provide a signature because the default one doesn't handlestd::function
.For example, we want to wrap the return type of:
We could define a wrapper and
def
using it:The Python side can now use the result as we want: