Search code examples
c++boost-mpltemplate-meta-programming

boost-mpl comparing iterators


Gosh, when working with mpl libraries, figuring out syntax is a hit-and-miss exerience (previous question ). What is the correct syntax to compare two mpl itterators -i.e., the 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;
   }
}

If I remove the assert the functor compiles and performs fine.


Solution

  • try boost::is_same<>, that should do the trick.