c++ - boost::fusion 访问关键类型的 union View 作为 map

标签 c++ boost-fusion

我正在尝试将 ash 框架转换为 c++ 以合并到我的项目中,我的开发环境是 Vista 32 和 Visual C++ 2008 Express,并且我正在使用 boost_1_37_0 库,我不打算升级环境,直到我取得一些成果...

给定:

typedef Component Pcomponent;
typedef WaitForstart2 Pcomponent2;
typedef boost::fusion::pair<ComponentWONTEXISTS,Pcomponent> component_pair1;
typedef boost::fusion::pair<WaitForstart2,Pcomponent2> component_pair2;

typedef boost::fusion::map<component_pair1> componentDictType1;
typedef boost::fusion::map<component_pair2> componentDictType2;

typedef boost::fusion::joint_view<componentDictType1, componentDictType2>joincomponentDictType;

我无法解决如何使用 at_key 访问其中一个类型

boost::fusion::at_key<ComponentWONTEXISTS, dictionaryjoint>(boost::fusion::as_map(dictionaryjoint));

谢谢,

P.S:我很着急,但我会尝试重新格式化问题

问候,

最佳答案

这很有趣,但我想我设法找到了解决方案:

    typedef boost::fusion::result_of::as_map<boost::fusion::joint_view<componentDictType1, componentDictType2> >::type MAPTYPE;
    MAPTYPE aDict;
    Pcomponent ptempj3 = boost::fusion::at_key<ComponentWONTEXISTS,MAPTYPE>(aDict);

关于c++ - boost::fusion 访问关键类型的 union View 作为 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19999964/

相关文章:

c++ - 我怎样才能使 std::find_if 和 std::map 使用一些 boost 库协同工作?

c++ - 是否可以将 fusion 图嵌套在 fusion 图内?

c++ - 静态、共享和可执行 - Windows 和 Linux

c++ - 迭代 BOOST_FUSION_ADAPT_ADT 结构中的元素?

c++ - 如何遍历 boost::fusion 序列?

c++ - 如何识别boost fusion vector 中的类型

c++ - 为什么 clang 使用 libstdc++ 删除包含 std::optional 的类型上的显式默认构造函数?

c++ - Qt - 控制外部进程

c++ - string::capacity/reserve() 算作终止 null 吗?

c++ - R6010-当 boost 文件系统的重命名或 copy_file 方法被命中时,中止被命中