PBC Library的element

    技术2025-12-26  12

    问题描述

    最近在使用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++封装版本的。

    Processed: 0.032, SQL: 9