Vector Sort Function
It's not ideal to call sort() for each element.  The first call already gives you the sorted vector, so each additional call just needlessly overwrites it.  This approach would also be very slow if the vector were much larger.

Since you're already returning a vector, you just need to sort once and then print once:

int main()
{
    std::vector&lt;int&gt; a = { 17, 12, 1, 20, 4, 6, 94 };

    a = sort(a);

    for (auto&amp; iter : a)
    {
        std::cout &lt;&lt; iter &lt;&lt; "\n";
    }
}


There's also no need for the typedef.  To help ensure you're using the proper type, you can use auto instead.  You should also replace the ints in sort() with auto.  Having higher compiler warnings would've alerted you to this type mismatch.