我想将以下类中的方法通过 pybind11 绑定到 python 中使用,但无奈看了好一会儿官方文档没有找到合适的例子(可能我眼瞎),所以来 V2 请求各位支招
class SEALContext
{
...
static auto Create(const EncryptionParameters &parms,
bool expand_mod_chain = true,
sec_level_type sec_level = sec_level_type::tc128)
{
return std::shared_ptr<SEALContext>(
new SEALContext(
parms,
expand_mod_chain,
sec_level,
MemoryManager::GetPool())
);
}
...
}
绑定 wrapper.cpp 中我是这么写的能编译通过:
PYBIND11_MODULE(seal, m) {
py::class_<SEALContext>(m, "SEALContext")
.def("Create", &SEALContext::Create)
}
我想在 Python 中 SEALContext.Create(parms)这样调用,经测试,Python 总是提示我需要传入三个参数,但我只想传入 parms 这一个,如果我在 wrapper.cpp 中限定,就编译不通过,然后不知道该怎么做了。。。 感谢各位了!