Generate another random path through a complete graph
From your code I'm guessing that you're doing some 2-opt for the TSP. And yes, it is possible to make it faster. The secret actually lies within your code, and is also the reason why your code isn't working. 

Disclaimer: I am no expert at C++

When you do newPath = oldPath, you're making newPath a vector that is identical to, but not the same as oldPath. Then you push all elements from oldPath onto newPath, thus making it twice as big as oldPath.

But since you already have a concise way of copying all values to a new vector, let's use that to speed things up: 

std::vector&lt;City&gt; GetRandomPathFast(std::vector&lt;City&gt; oldPath)
{
    std::vector&lt;City&gt; newPath = oldPath;

    int randPoint = rand() % (oldPath.size()-1);
    int randPoint2 = rand() % (oldPath.size()-1 - randPoint) + randPoint;

    int k = 1;
    for(int i=randPoint; i &lt; randPoint2; i++)
    {
        newPath[i] = oldPath[randPoint2-k];
        k++;
    }
    return newPath;
}


By only modifying the values between randPoint and randPoint2, we get a significant speedup. We also get a path of the correct length, with a part of it reversed. 

For benchmarking, I changed both your function and my new to use std::vector&lt;int&gt;, but numbers should carry over to your implementation.

Vector of length 1000, 10000 iterations of each function:
Time for GetRandomPath: 280.624 ms
Time for GetRandomPathFast: 22.136 ms