1

天哪,在使用 mpl 库时,弄清语法是一个偶然的经历(上一个问题)。比较两个 mpl 迭代器的正确语法是什么 - 即it != v.end()test ?

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;
   }
}

如果我删除断言,仿函数将编译并执行良好。

4

1 回答 1

2

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

于 2011-05-18T13:35:24.670 回答