标签:list prime div argv prim color lag void ++
1 void func(forward_list<string>& flst, const string& s1, const string& s2) { 2 auto bb = flst.before_begin(); 3 bool flag = false; 4 for (auto j : flst) { 5 if (j == s1) 6 { flag = true; break; } 7 } 8 for (auto i = flst.begin(); i != flst.end(); ++i) 9 { 10 if (*i == s1) 11 { 12 bb = i; 13 flst.insert_after(bb, s2); 14 } 15 else 16 bb = i; 17 } 18 if (flag == false) { flst.insert_after(bb, s2); } 19 } 20 int main(int argc, char* argv[]) 21 { 22 forward_list<string>f{ "1","2","3","4" }; 23 func(f, "5", "6"); 24 for (auto i : f) 25 cout << i << endl; 26 }
标签:list prime div argv prim color lag void ++
原文地址:https://www.cnblogs.com/otakus/p/12905908.html