c++ : Peer review if anyone would be so kind and/or is bored:)

Started by
12 comments, last by Guthur 15 years, 5 months ago
Why is FindSubNode member of loader, and not node? It has nothing to do with Collada, but everything with XML node. It would make implementation somewhat simpler.
Advertisement
Quote:Original post by Antheus
Why is FindSubNode member of loader, and not node? It has nothing to do with Collada, but everything with XML node. It would make implementation somewhat simpler.


I was just thinking that myself when i was adding it :), not a big deal i can move it, this was actually more a means to something else but i wanted to have it check over by the good people here :p

Also guys thanks for bringing up the Size() operation that info is good to have, :)

also the const string was good advice thanks. I really do need to make my code more strict.
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.
Quote:
Hmm, fair point. It just seems to me that size() is a much more common function to see in code than splice(). Then again, maybe it's just the code I see

If you have chosen to use a std::list, then probably you are not interested in size(), but interested in the relinking capabilities (e.g splice) - e.g moving a whole list onto another one if the original is not needed any more.

In any case, if you mean to test if a container is empty (or not empty), empty() conveys the meaning better and is performance-wise faster than or equal to size().
I have implemented the changes as suggested; using empty() now.

Thanks alot everyone, thorough as always :)

Edit: if anyone is interested i removed the allocation of 'tn' from the while loop, its just a reassignment now, not sure if it would make a big difference.
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.

This topic is closed to new replies.

Advertisement