boost::mpl::vector - getting to a type's base-offset

前端 未结 2 712
既然无缘
既然无缘 2021-01-13 22:41

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

2条回答
  •  没有蜡笔的小新
    2021-01-13 23:32

    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 types;
    typedef find::type iter;
    
    BOOST_MPL_ASSERT(( is_same< deref::type, unsigned > ));
    BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 );
    

提交回复
热议问题