Create a template
template
void dumpStrings(iterator_type it, iterator_type end)
{
while (it != end) {
cout << *(it++) << endl;
}
}
The template also removes the limit of the container value type to string. Note that you need the parentheses around the it++.