我正在尝试腌制一个用类包装器装饰的对象
BaseObj
但是当我用pickle / dill / joblib编写Can't pickle <class '{package}.{file}.Wrapper'>:
it's not found as {package}.{file}.Wrapper
的实例时,我得到了
template<typename T>
class Numeric
{
public:
Numeric() : val(T()) { cout << "ctor default\n"; }
explicit Numeric(const T& v) : val(v) { cout << "ctor value\n"; }
Numeric(const Numeric& v) : val(v.val) { cout << "copy ctor\n"; }
Numeric(Numeric&& v) { val = v.val; cout << "cmove\n"; v.val = 0; }
Numeric& operator=(const Numeric& v) { val = v.val; cout << "copy assignment\n"; return *this; }
Numeric& operator=(Numeric&& v) { val = v.val;cout << "amove\n"; return *this; }
~Numeric() { cout << "dtor\n"; };
private:
T val;
};
// ----------- main ------
Numeric<int> c1(Numeric<int>(2)); // calls the normal constructor instead of copy constructor
任何人都有想法/建议。实际位置不是{package}。{file} .Wrapper,因为它是在装饰器中定义的?
谢谢!