Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtaining const_iterator from iterator

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

I.e. f<std::vector<T>::iterator>::type should yield std::vector<T>::const_iterator.

like image 545
fredoverflow Avatar asked Feb 24 '11 14:02

fredoverflow


1 Answers

I am not aware of such a metafunction.

Not all iterators have a corresponding const_iterator. E.g. insert_iterator. So such a metafunction would need to decide what it is going to do in such cases.

like image 160
Howard Hinnant Avatar answered Oct 05 '22 01:10

Howard Hinnant