I have converted this simple method from C# to C++. It reads a path table and populates a list of lists of ints (or a vector of vectors of ints).
A sample line from
Haven't tested the code but how many ints
does it typically load? Consider what happens when each of your vectors
reaches its capacity
. A vector
grows inefficiently - O(n) I believe. C#'s List
doesn't have this behaviour.
Consider using std::deque
, std::list
or some other container that has better growth behaviour. See this article for more info.