Is it possible to get at the offset of a mpl::vector
after performing a mpl::find
on it ?
Put differently I want to do the
Their is a metafunction in the itterator category to do just this, it is called distance.
p.s., apologies for answering my own question so quickly. I just stumbled on the solution.
If what you're looking for is a kind of indexOf feature, I guess the example from Boost.MPL doc concerning find
will do the trick:
typedef vector<char,int,unsigned,long,unsigned long> types;
typedef find<types,unsigned>::type iter;
BOOST_MPL_ASSERT(( is_same< deref<iter>::type, unsigned > ));
BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );