我正在尝试为cpp文件编写python包装器。 cpp文件由一个类组成,该类包含用户定义的数据成员,构造函数和成员函数。如何在包装文件中定义cpp文件的数据成员?
ex.cpp
c1类
{
公开
: using ct_coeff_type = std::uint64_t;
using size_type = IntArray<ct_coeff_type>::size_type;
}
我将包装器写为
wrapper.cpp
py :: class_(m,“密文”)
.def(py::init<>())
.def(py::init<const Ciphertext &>())
.def(py::init<MemoryPoolHandle &>())
.def(py::init<std::shared_ptr<SEALContext> &, MemoryPoolHandle &>())
.def(py::init<std::shared_ptr<SEALContext> &, parms_id_type &, MemoryPoolHandle &>())
.def(py::init<std::shared_ptr<SEALContext> &, parms_id_type &, size_type &, MemoryPoolHandle &>())
.def("reserve", (void (Ciphertext::*)(std::shared_ptr<SEALContext> &, parms_id_type &, size_type &)) &Ciphertext::reserve,
"Allocates enough memory to accommodate the backing array of a ciphertext with given capacity");