As an extension to this question Are const_iterators faster?, I have another question on const_iterators. How to remove constness of a const_iterator
const_iterators
const_iterator
Unfortunately linear time is the only way to do it:
iter i(d.begin()); advance (i,distance(i,ci));
where iter and constIter are suitable typedefs and d is the container over which you are iterating.