Should an iterator be valid after appending to a Glib::ustring?

Are iterators into a Glib::ustring still valid after the string is
modified?  Specifically appended to or modified at or beyond where the
iterator points.  Especially if appending to the string causes the
underlying bytes to be relocated to a larger allocation.  I didn't
obviously see this mentioned in the documentation.

I though it might be valid because the iterator appears to be
implemented using a pointer difference type.  However the following
small test program fails with:
  ** main(): assertion failed: (linestart <= cursor)


--8<-- --8<--
#include <glib.h>
#include <glibmm/ustring.h>

int main()
    Glib::ustring buf;
    Glib::ustring::iterator linestart = buf.begin();
    Glib::ustring::iterator cursor = buf.begin();
    gunichar uc = 'u';
    buf.append(1, uc);
    cursor = buf.end();
    g_assert(buf.begin() <= linestart);
    g_assert(linestart <= cursor);
    g_assert(cursor <= buf.end());
    return 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]