Category : list

I am having problem with removing element (by name) from list… //REMOVE ALL compatibleArgs FROM compatibleList for (auto & compatible: compatibleList) //LOAD COMPATIBLES { for (auto & remaining: argsRemaining) //LOAD REMAINING { string remainingNew = remaining; //COPY REMAINING string::size_type pos = remaining.find(":"); //FIND COLON POSITION if (pos != string::npos) //REMAINING CONTAINS COLON { remainingNew = ..

Read more

#include <iostream> #include <list> using namespace std; int main () { list<int> mylist; list<int>::iterator it; for(int i=1;i<6;i++){ mylist.push_back(i); } for (it=mylist.begin(); it!=mylist.end(); ++it) cout << ‘ ‘ << *it; cout<<endl; for(it=mylist.begin(); it!=mylist.end();it++){ if((*it)==2){ mylist.erase(it); mylist.insert(it,9); break; } } for (it=mylist.begin(); it!=mylist.end(); ++it) cout << ‘ ‘ << *it; cout<<endl; return 0; } It seems that ..

Read more