c++递归地输出vector的内容

 1 #include<iostream>
 2 #include<vector>
 3 using namespace std;
 4 using std::vector;
 5 
 6 using Iter = vector<string>::iterator;
 7 
 8 void printStr(Iter beg, Iter end){
 9     if(beg != end){
10         cout << *beg << endl;
11         printStr(beg + 1, end);
12     }
13 }
14 
15 int main(){
16     vector<string> str={"aa", "bb", "cc"};
17     printStr(str.begin(), str.end());
18     return 0;
19 }
原文地址:https://www.cnblogs.com/Ronnie-97/p/14944753.html