Obtaining const_iterator from iterator

前端 未结 4 1121
余生分开走
余生分开走 2020-12-16 16:24

Is there a metafunction f that maps an iterator to its corresponding const_iterator?

I.e. f::ite

4条回答
  •  一向
    一向 (楼主)
    2020-12-16 16:49

    I can think of something for a reverse_iterator: using the base member function the decltype, one could extract the return type to get back to the iterator.

    However there is no such function for iterator / const_iterator, so it's hard to see how this could be achieved, short of providing an inner typedef or requiring explicit specialization.

提交回复
热议问题