PBC Library的element_t不能插入vector中

问题描述

最近在使用PBC库写关于双线性对的代码时,恰巧想用向量vector来存储元素element_t变量,但是却碰见了意外。
首先我声明了一个element_t的向量。

std::vector<element_t> tau;

然而,当我想要push_back()

for(int i=0;i<blockNum;i++){
	in_tau>>buff;
	element_t tem_tau;
	element_init_Zr(tem_tau, pairing);
	element_set_str(tem_tau, buff, 16);
	tau.push_back(tem_tau);
}

报错了,错误很长这里就不贴了。

未解决

由于摆渡了半天也没发现答案,并且这个库比较小众,所以就去外边找了找,在stack overflow上找到了类似的问题。下边的回答是这样写的

I think the problem is that PBC is a C lobrary and element_t is missing the required copy constructor for vector to work with it. Note that there is a C++ wrapper for PBC avaliable.

注意,PBC库是有C++封装版本的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章