我正在使用 boost python 来实现 C++ 和 Python 之间的互操作性。我在 c++ 中有枚举和结构,并且在 c++ 中有可以将这些结构作为参数的函数。我可以通过使用 boost python 在 python 中访问这个函数,但我不知道如何在 python 中将结构作为参数发送。Set 是 c++ 中的函数,可以将结构作为参数获取。所以在 python 中,我如何将这个结构作为参数发送。我能够在 python 中获得此功能,但无法将发送结构作为参数发送。谢谢您的帮助。
c++中的结构如下:
enum days
{
friday,
saturday
};
struct example
{
days m_day;
std: string m_value;
};
Class Base
{
public:
void Set(example& Result) = 0;
}
class Derived
{
public:
void Set(example& Result)
{
Result.m_day = friday;
}