boost-mpl比较迭代器

时间:2011-05-18 13:13:53

标签: c++ boost-mpl template-meta-programming

天哪,在使用mpl库时,弄清楚语法是一种不可思议的经历(previous question)。比较两个mpl itterators -i.e.,it != v.end()测试的正确语法是什么?

template<typename T> 
struct get_type_ordinal
{
  rbl_type_ordinal_type operator()()
  {
    typedef typename boost::mpl::find<rbl_type_mpl_vector,T>::type it;
    typedef typename boost::mpl::end<rbl_type_mpl_vector>::type end;

    BOOST_MPL_ASSERT_NOT (( boost::mpl::equal_to< it, end >)); // problem here
    return it::pos::value;
   }
}

如果我删除了断言,则仿函数编译并执行正常。

1 个答案:

答案 0 :(得分:2)

尝试boost::is_same<>,这应该可以解决问题。

相关问题