//myListsplice2.cpp #include #include #include using namespace std; //list spice function int main() { string str1[] = {"A", "C", "B","D"}; string str2[] = {"E", "F","G","H"}; // to be splied list Lstr1(str1, str1+4); // holder of splice object list Lstr2(str2, str2+4); // cout<<"\n Lstr1.size() : " << Lstr1.size() <:: iterator it; cout<<"\n Origninal string ------ "; cout<<"\n Lstr1 ---> "; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } it = Lstr2.begin(); it++; it++; Lstr2.splice(it, Lstr1); // copy Lstr1 to Lstr2 with splice cout<<"\n----Lstr1 after splice-------"; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } cout<<"\n---Lstr2 after Splice into 3rd place \n"; for(it= Lstr2.begin(); it !=Lstr2.end(); it++) { cout <<" "<< *it; } return 0; }