提问者:小点点

在Boost Python模块中包装typedef结构


我在标题中定义了一个typedef,如下所示:

typedef struct data
{
    std::string id;
    std::string status;

} data_set;

我希望能够将其包装在一个Boost Python模块中,使其可用,因为它被传递到其他方法中。 在Boost中是否会将其包装为一个类? 或者是否有包装typedefs的特定方法?


共1个答案

匿名用户

我觉得你不需要这里的typedef。 简单地

struct data_set
{
    std::string id;
    std::string status;

};

基本上是等价的。 话虽如此,现在您可以将它作为一个具有Boost Python模块的类来处理。