pybind11:转换boost :: container ::向量列表
类似于boost ::可选
的type_caster
pybind11文档我需要一个用于boost :: container :: vector :: vector< t>
。
不幸的是,我正在尝试
namespace pybind11 { namespace detail {
template<typename T>
struct type_caster<boost::container::vector<T>> : list_caster<boost::container::vector<T>, boost::container::allocator<T>>
{
};
}} // namespace pybind11::detail
这不起作用。
由于矢量相当大,我还需要避免复制它,因此也宣布为:
PYBIND11_MAKE_OPAQUE(boost::container::vector<SomeCustomStruct>)
Similar to the type_caster
for a boost::optional
described in the pybind11 documentation I need one for a boost::container::vector<T>
.
I was trying
namespace pybind11 { namespace detail {
template<typename T>
struct type_caster<boost::container::vector<T>> : list_caster<boost::container::vector<T>, boost::container::allocator<T>>
{
};
}} // namespace pybind11::detail
which unfortunately did not work.
As the vector is fairly big, I also need to avoid copying it and hence also declared:
PYBIND11_MAKE_OPAQUE(boost::container::vector<SomeCustomStruct>)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论