Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

!X.Empty() should be used instead of X.Size() #13

Open
Echelon9 opened this issue Jul 10, 2014 · 0 comments
Open

!X.Empty() should be used instead of X.Size() #13

Echelon9 opened this issue Jul 10, 2014 · 0 comments

Comments

@Echelon9
Copy link
Contributor

As an example, the DS_WeightedGraph.h implementation of GetShortestPath() and GetSpanningTree() use the following template:

for (col=0; X.Size(); col++)
    path.Insert(X.Pop(), _FILE_AND_LINE_);

It was probably intended to use !X.Empty() instead.

Note, there is a potential performance impact here (unquantified) given this is designed to be a performant algorithm.

Echelon9 added a commit to Echelon9/RakNet that referenced this issue Jul 10, 2014
@Echelon9 Echelon9 changed the title It is possible i < X.size() should be used instead of X.size() !X.Empty() should be used instead of X.Size() Jul 14, 2014
Echelon9 added a commit to Echelon9/RakNet that referenced this issue Jul 14, 2014
Echelon9 added a commit to Echelon9/RakNet that referenced this issue Mar 6, 2015
Echelon9 added a commit to Echelon9/RakNet that referenced this issue Mar 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant