Home Help Center

a problem about how to modify a value at the iterator’s current position!

first i define a struct and a sequence in ice file.
struct stCommMess
{
string sUserId;
string sMessage;
};
sequence <stCommMess> seqMessList;

then build a freeze map,UserIdMessageMap, the key_value is string ,and the map_value is seqMessList.

when i would like to modify the map_value ,i have to do like this:

...
UserIdMessageMap::iterator p,
seqMessList b = p->second;
b.push_back(a);//a is object of stCommMess
p.set(b);
....

a simple push_back operate has to do like that ,as a low efficient operate.
is there another method to insert the stCommMess into the map?

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Your code is correct, and unfortunately Freeze does not offer a more efficient way to perform such updates. I started an internal discussion on this issue.

    Best regards,
    Bernard
Sign In or Register to comment.