#include <boost/variant.hpp>#include <boost/mpl/vector.hpp>typedef boost::mpl::vector< float,math::float2,math::float3,relative_point<1>,relative_point<2>,relative_point<3>,std::string,color,group,dictionnary,reference,line,strip,text,Font> variant_mpl_vec;typedef boost::make_variant_over<variant_mpl_vec>::type data_type;// This is the old deFinition/*typedef boost::variant< float,Font> data_type;*/
我直接把我的代码.大多数类型都是包含很少数据的结构.
编译时,我有一个奇怪的:
error: no matching function for call to ‘boost::detail::variant::make_initializer_node::apply<boost::mpl::pair< ... and lots more ...
以前的变体定义工作正常,所以我很惊讶我的替换不起作用.我是mpl的新手,所以也许我错过了什么 – 但找不到什么!我做得好吗?
提前致谢.
解决方法 变体类型定义是正确的,问题是由于程序中的泛型函数采用任意变量作为参数.实际上,make_variant_over< mpl :: vector< T0,T1,...>>表现得像变体< T0,...>但不是同一类型:它是变体< over_sequence< vector< T0,...>>> (因此T0对应于over_sequence< vector< T0,...>. 总结以上是内存溢出为你收集整理的c – 使用mpl :: vector定义boost :: variant类型全部内容,希望文章能够帮你解决c – 使用mpl :: vector定义boost :: variant类型所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)