Iterating an object and erasing members #361
-
|
I assumed the object works like an std::map and learned that the container is a vector. If I have to erase the member I copy the iterator to tmp and increment the iterator. This is to ensure that it points to a valid element after erase. Having a solution is fine. Is there a better way to get this working? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Yes, jsoncons uses flat-map semantics, currently using I think is actually undefined behavior, I think it should be except the jsoncons Daniel |
Beta Was this translation helpful? Give feedback.
-
|
This change has been made on master, the Incidentally, instead of |
Beta Was this translation helpful? Give feedback.
This change has been made on master, the
basic_json::erasefunction return value, previously void, is now an iterator following the last removed element,Incidentally, instead of
it->name(), useit->key(),name()was deprecated a long time ago, that should have resulted in a warning. To be sure that you're not using any deprecated functions, you may want to define theJSONCONS_NO_DEPRECATEDmacro.