小编jkp*_*jkp的帖子

使用boost-spirit解析大型结构

我可以编译此页面上的员工示例代码.

如果我用8个字符串扩展结构,如下所示:

struct employee
{
    int age;
    std::string surname;
    std::string forename;
    std::string a1;
    std::string a2;
    std::string a3;
    std::string a4;
    std::string a5;
    std::string a6;
    std::string a7;
    std::string a8;
    double salary;
};
Run Code Online (Sandbox Code Playgroud)

(当然我也扩展了BOOST_FUSION_ADAPT_STRUCT和语法),当我尝试编译时,我得到以下错误:

../include/boost/fusion/container/vector/convert.hpp:26:13: error: invalid use of incomplete type ‘struct boost::fusion::detail::as_vector<12>’
../include/boost/fusion/container/vector/detail/as_vector.hpp:26:12: error: declaration of ‘struct boost::fusion::detail::as_vector<12>’
Run Code Online (Sandbox Code Playgroud)

我发现如果我的struct有> 10个项目会发生这种情况.两个问题:

  1. 为什么这个限制?
  2. 我该如何解决?

欢迎任何输入.

c++ boost-spirit

2
推荐指数
1
解决办法
606
查看次数

标签 统计

boost-spirit ×1

c++ ×1