Hello,
While reading the code, I wanted to find out how units where managed on memory side.
I found out it was a container defined according to this :
https://github.com/spring/spring/blob/d ... /UnitSet.h
Please tell me if I'm mistaking.
Why is it a std::set ? which is an ordered container which mean every insert/delete is in O(log(n)) unless you give an iterator/pointer to the contained object (a pointer to a CUnit*) in which case it is in O(1).
http://en.cppreference.com/w/cpp/container/set
Why not an unordered_set ? http://en.cppreference.com/w/cpp/contai ... rdered_set
Do you really have a need for ordered pointers ?
If you do not have a c++11 compliant compiler, there is still http://www.boost.org/doc/libs/1_56_0/do ... d_set.html
CUnitSet
Moderator: Moderators
Re: CUnitSet
The iteration of that container have to be a fixed order on all computers for syncing reasons, also check the comparison operator (it compares ids, not pointer locations).
-
- Posts: 8
- Joined: 20 Aug 2014, 22:21
Re: CUnitSet
Ok, the id comparison was my next question.
Before asking, I did try to figure out where CUnitSet was used with a notepad++ Ctrl+F to list everything and did not saw anything except for group handling, selecting and list in Team (mainly).
I did not worked out how Sync works.
Before asking, I did try to figure out where CUnitSet was used with a notepad++ Ctrl+F to list everything and did not saw anything except for group handling, selecting and list in Team (mainly).
I did not worked out how Sync works.