【问题标题】:Wrapping typedef struct in Boost Python module在 Boost Python 模块中包装 typedef 结构
【发布时间】:2020-11-20 05:36:49
【问题描述】:

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

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

} data_set;

我希望能够将其包装在 Boost Python 模块中以使其可用,因为它已传递给其他方法。这会被包装为 boost 中的一个类吗?或者有没有特定的方法来包装 typedef?

【问题讨论】:

    标签: c++ boost struct typedef boost-python


    【解决方案1】:

    我认为您在这里不需要 typedef。简单的

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

    相当于mostly。话虽如此,现在您可以将其视为具有 Boost Python 模块的类。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-23
      • 2012-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多