All the elements are added at the beginning (or in rare occasions such as if configuration file is reloaded). So then it shouldnt be a problem using a vector (which would after sort and erasing duplicates operations store only unique elements) and sending it over to the clients. From your post above I guess this would be the best solution?
Many thanks!
>> From your post above I guess this would be the best solution? <<
It depends on how many duplicates. If 90% of the data is a duplicate, then perhaps not. But if 10% of the data is a duplicate, then yes, it sounds pretty good.
>> I changed the code (see above, red color). <<
Did you only change the spacing? Calling something "horrible code" implies that more than just formatting is bad. And BTW, I prefer cpjust's formatting when actually writing such code (although not when posting to the forum).
OK, how's this formatting instead?
That's usually how I'd format it when I'm not in a hurry.Code:for ( mapStrSet::iterator it = map_str_set.begin(); it != map_str_set.end(); ++it ) { map_str_vector.insert( mapStrVector::value_type( it->first, std::vector<std::string>( it->second.begin(), it->second.end() ) ) ); }
I just wish this site used tabs that were 4 spaces wide, so I wouldn't have to fix it when copying from VC++ to here.
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
Yeah, I meant that it's so much complexity for something that sounds so easy. That's what I meant with horrible.
Btw, I contracted the spaces to make it more compact.
I think it's slightly better, but I prefer to separate the arguments myself.
Since insert is a function, I put its arguments on new lines.
And if there's just one or max two arguments dependant on each other, I put them all on a single row.
It makes it so much easier to see what ) and ( which belongs to where and what arguments function X and function Y takes.
Now there's something we agree on!I just wish this site used tabs that were 4 spaces wide, so I wouldn't have to fix it when copying from VC++ to here.
Btw, I never really commented on your style. You are one of the few who write code the way I do and like