I am working with some big (megabytes) strings, and I need to modify them by inserting and removing characters at different locations.

To make it more efficient, instead of searching insertion/deletion points every time, I would like to have "cursors" or "tags" which are still valid if text is inserted (i.e. they are moved accordingly), and are still valid if the removed text is not "enclosing" the cursor position (i.e. a cursor becomes invalid only if it was in the removed substring, other cursors are moved accordingly).

I do not need to operate on the string concurrently, but insertion/deletion operations happen always one at time.

Do you know how this can be done with standard C++, boost or a portable, lightweight library?