2011-05-18 170 views
1

天哪,在使用mpl库时,找出语法是一个碰碰运气(previous question)。什么是正确的语法来比较两个mpl itterators - 即,it != v.end()测试?boost-mpl比较迭代器

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

如果我删除断言函子编译并执行良好。

回答

2

尝试boost::is_same<>,这应该做的伎俩。

+0

我早些时候试过,它没有工作,但我使用'BOOST_STATIC_ASSERT'。出于某种原因,它现在正在工作。谢谢Nim。 – 2011-05-18 13:38:40