Here is the code to my main method, it should be obvious what i'm trying to do with trying to get the iterator to access an element by name
#include <iostream>
#include <list>
#include "PC.h"
#include "SunServer.h"
using namespace std;
int main(){
PC mypc1("John", "645.22.55.34", 128, "admin");
PC mypc2("Mike", "645.22.55.34", 128, "admin");
PC mypc3("Rick", "645.22.55.34", 128, "admin");
PC mypc4("Bill", "645.22.55.34", 128, "admin");
list<PC> my_group;
my_group.push_front(mypc1);
my_group.push_front(mypc2);
my_group.push_front(mypc3);
my_group.push_front(mypc4);
list<PC>::iterator curr = my_group.begin();
while (curr != mypc2){
// do something
}
}
Now obviously it doesn't work, but is there something I can do that would be equivalent to this? Thank you
++curr