繁体   English   中英

boost python 中的 enable_pickling 和 pickle_suite 有什么区别?

[英]What is the difference between enable_pickling and pickle_suite in boost python?

我有一个相当大的 class 有大约 40 个属性,但只有 15 个作为 arguments 传递给构造函数:

class MyClass{
    /*40 attributes here*/
    MyClass(/*15 args here, the rest are initialized at default values*/);
};

I'm trying to implement pickle support for this class, and so far the boost.python documentation seems to indicate that I can either implement an instance of the pickle_suite class, or I can just do .enable_pickling() and let python handle the rest . 与仅使用一行代码相比,花时间实现所有__getinitargs__和其他东西有什么优势吗? 据我了解,酸洗本质上是将对象转换为一堆 1 和 0 并传递它。

谢谢

没关系,看起来普通的 python pickler 无法复制容器内的元素,如 std::vector 或 std::pair

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM