Problem with vector iterator
Hello.
I began playing around a little with iterators for an std::vector a while back for my programming project I'm currently working on, and am basically trying to use them right now to access a vector object (stored inside of a map)'s elements (which are instances of a struct named "S_html_attr_value"), and modify them to add some information not originally given in an earlier class I built (such as setting a 'notes' and 'tips' property for them). Now, my original thought was that I could modify the vector inside of the map without having to copy the vector content into a new vector object (and then copy it back into the map after removing the old vector, once the changes are made...), and simply modify the original vector inside of the map instead. However, attempting to do this has run me into a number of issues (starting with a segfault, continuing with a segfault even after I tried a number of things to fix it, and now when I C/Ped it into codepad.org's, and modified the original concept a little, the error its giving me now (at least on codepad.org) complains about "trying to increment a singular iterator", even though the iterator is supposed to be a random access iterator which shouldn't have any problems. I suspect it has something to do with std::map's behavior with vector mapped values, since using just a vector and no map, the code works just fine. Anyway, I tried many different things, which I wont go to any great length to explain right now, as that would take too long. :tongue:
Here is basically where I'm stuck right now (click the link to see the
code):
C++ code - 158 lines - codepad
The line of most interest is 153. Try commenting it out, and you'll see the error disappears.