在我的代码中,我使用了许多 NTL 向量和矩阵作为类成员。大多数变量可以初始化为零长度向量或矩阵。但是最后一个(randE),它以某种方式默认为大小= 4444736032并固定的向量。
class MyClass
{
public:
shared_ptr<OtherClass> ptr;
Mat<ZZ_p> A;
Mat<ZZ_p> B;
Mat<ZZ_p> C;
Vec<ZZ_p> D;
Vec<ZZ_p> randA;
Vec<ZZ_p> randB;
Vec<ZZ_p> randC;
ZZ_p randD;
Mat<ZZ_p> E;
Vec<ZZ_p> randE;
MyClass(
const shared_ptr<OtherClass> &ptr;
const Mat<ZZ_p> &A,
const Mat<ZZ_p> &B,
const Mat<ZZ_p> &C)
{
this->ptr = ptr;
this->A = A;
this->B = B;
this->C = C;
}
}
我试图在构造函数中添加初始化,它会抛出一个错误,由于向量是固定的,它不能改变它的长度。
// Error: SetLength: can't change this vector's length
this->randE = Vec<ZZ_p>();