关于创建NTL类类型 [英] Regarding create a NTL class type
本文介绍了关于创建NTL类类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
感谢您查看
我想创建一个类
long lPrime,lGenerator;
lPrime = atol(vOut[1].c_str());
ZZ alicePrime;
alicePrime = new ZZ(99999,lPrime);
我不知道INIT_VAL_TYPE要求我输入什么。
I not sure what does INIT_VAL_TYPE asking me to input.
我遇到这个错误:
UDPEchoClient.cpp:85:34: error: no matching function for call to ‘NTL::ZZ::ZZ(int, long int&)’
UDPEchoClient.cpp:85:34: note: candidates are:
/sw/include/NTL/ZZ.h:113:1: note: NTL::ZZ::ZZ(NTL::ZZ&, NTL::INIT_TRANS_TYPE)
/sw/include/NTL/ZZ.h:113:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::ZZ&’
/sw/include/NTL/ZZ.h:176:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, double)
/sw/include/NTL/ZZ.h:176:8: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:180:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, float)
/sw/include/NTL/ZZ.h:180:8: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:172:8: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, const char*)
/sw/include/NTL/ZZ.h:172:8: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:61:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, unsigned int)
/sw/include/NTL/ZZ.h:61:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:60:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, long unsigned int)
/sw/include/NTL/ZZ.h:60:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:58:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, int)
/sw/include/NTL/ZZ.h:58:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:57:1: note: NTL::ZZ::ZZ(NTL::INIT_VAL_TYPE, long int)
/sw/include/NTL/ZZ.h:57:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_VAL_TYPE {aka const NTL::INIT_VAL_STRUCT&}’
/sw/include/NTL/ZZ.h:49:1: note: NTL::ZZ::ZZ(const NTL::ZZ&)
/sw/include/NTL/ZZ.h:49:1: note: candidate expects 1 argument, 2 provided
/sw/include/NTL/ZZ.h:37:1: note: NTL::ZZ::ZZ(NTL::INIT_SIZE_TYPE, long int)
/sw/include/NTL/ZZ.h:37:1: note: no known conversion for argument 1 from ‘int’ to ‘NTL::INIT_SIZE_TYPE {aka const NTL::INIT_SIZE_STRUCT&}’
/sw/include/NTL/ZZ.h:33:1: note: NTL::ZZ::ZZ()
/sw/include/NTL/ZZ.h:33:1: note: candidate expects 0 arguments, 2 provided
推荐答案
> new 是错误的。你不是分配一个对象,你正在构造一个对象。
Firstly new
is wrong. You aren't allocating an object, you are constructing an object.
其次,假设我正在读头文件,假设我明白你在尝试你只需要
Secondly, assuming I'm reading the header file right, and assuming I understand what you are trying to do, you just want
ZZ alicePrime(INIT_VAL, lPrime);
INTI_VAL
编译选择给予 alicePrime
一个初始值而不是初始位大小的构造函数。
INTI_VAL
is just a constant that forces the compile to choose the constructor that gives alicePrime
an initial value, instead of, say, an initial bit size.
NTL文档很差。
这篇关于关于创建NTL类类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文