大佬教程收集整理的这篇文章主要介绍了c – BOOST MPL添加两个list_c对象会导致意外行为,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#include <boost/mPL/list_c.hpp> #include <boost/mPL/transform.hpp> #include <boost/mPL/plus.hpp> #include <boost/mPL/equal.hpp> #include <boost/mPL/equal_to.hpp> #include <boost/mPL/assert.hpp> #include <iostream> #include <typeinfo> #include <assert.h> using namespace boost::mpl; typedef list_c<long,2,4,6,8,10> evens; typedef list_c<long,3,5,7,11,13> primes; typedef list_c<long,9,13,19,23> sums; typedef transform< evens,primes,plus<> >::type result; BOOST_MPL_ASSERT(( equal< result,sums,equal_to<_1,_2> > )); int main() { std::cout << typEID(sums).name() << std::endl << typEID(result).name() << std::endl; assert(typEID(sums) == typEID(result)); }
它编译,所以BOOST_MPL_ASSERT成立.但是,在运行它时,main函数中的断言失败.这是什么意思?不应该两个list_c的东西(我似乎缺少正确的单词)包含相同的元素定义相同的类型?
谢谢您的帮助.
以上是大佬教程为你收集整理的c – BOOST MPL添加两个list_c对象会导致意外行为全部内容,希望文章能够帮你解决c – BOOST MPL添加两个list_c对象会导致意外行为所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。