我正在尝试将 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/