Quick Sort on C++ vector
You don't need to pass the vector itself. left and right iterators provide all the necessary information.

That said, you pass a correct right: too often people pass it as .end() - 1 which indeed leads to unnecessary complications.
Partitioning is an important algorithm on its own right and deserves to be factored out.
The lines

if (size == 2 &amp;&amp; *pivot &lt; *left) {
    std::iter_swap(left, pivot);
}


serve no purpose. The code works fine without them.
The trickiest part is achieving best performance.


The poor choice of pivot may result in quadratic time complexity. In a professional implementation choosing pivot is the most complex part.
In general, C++ is very good in eliminating tail recursion, but in this particular case it may use some help. Specifically, you'd want to recurse into smaller partition, and iterate over the larger one.
Another optimization is a timely switch to insertion sort. Instead of descending all the way to size &lt;= 1 it is beneficial to stop recursion earlier (say, when size &lt;= 16). Once the recursions are completed, the range is almost sorted, and insertion sort runs in linear time.