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
I believe this conversion is not needed in good designed program.
If you need do this - try redesign code.
As workaround you can do next:
typedef std::vector< size_t > container_type;
container_type v;
// filling container code
container_type::const_iterator ci = v.begin() + 3; // set some value
container_type::iterator i = v.begin();
std::advance( i, std::distance< container_type::const_iterator >( v.begin(), ci ) );
But I'm think that sometimes this conversion is impossible, because your algorithms can haven't access to container.