Ow ****, ln->begin() equals lines.begin()->begin() that is, it pointes to the first element (char) of the vector, and ln->end() points to one beyond...
I suspect that .insert() doesn't want a const argument. Try making i ::iterator instead of ::const_iterator. Also, as .begin()/.end() are used rather...