Obtaining const_iterator from iterator

前端 未结 4 1124
余生分开走
余生分开走 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:39

    I don't think this is possible since there is often no well-defined mapping between iterator types. E.g., two containers could share the non-const iterator type, but have different const iterators. In general you can only map from container types to iterator types, but not between iterator types or from an iterator type to a container type.

提交回复
热议问题