Advertisements I have implemented a rudimentary vector using the code from the Weiss C++ textbook on data structures (see below). when i time it with 100,000 push_backs it takes 0.001 seconds. when i do the exact same experiment using the stl::vector, it takes 0.008 seconds (roughly 8x slower). does anyone know why this is? thanks… Read More why is my rudimentary implementation of Vector faster than the stl version for push_back?
Advertisements I’m working through a tree traversal problem and using ‘push_back’ vector function to update a vector with the in-order traversal. Alongside using this I am using cout to print out the solution to debug. The print output is correct but my returning vector doesn’t match the print so I can only put this down… Read More push_back() is not adding element to the vector? (C++ Tree Traversal)
Advertisements I have a vector variable named intVec, and I have a function named pushBack, that accepts a vector of type integer just like intVec, but when I actually pass that vector into the function in order to push_back the x parameter, nothing seems to happen. Output expected from intVec.size() is 1 Output given from… Read More Vector parameter in a function doesn't seem to actually apply to input?