No need to muck about with iterators, adding a loop, and 2 function calls to test for empty: it's a std::vector under the hood, so use .empty(), and inline it.