C
cornelis van der bent
In my code I want to go through all combinations of two items in a
list. Here is my code:
list<Instance*>::iterator i;
for (i = instances.begin(); i != --instances.end(); i++)
{
list<Instance*>::iterator j;
for (j = i + 1; j < instances.end(); j++)
{
// Do something!
}
}
I get a big error message at i + 1. I got a similar message when I
wrote
i != instances.end() -1, but fixed this by writing --instances.end().
My question what must I write instead of i + 1?
Thanks for listening!
Kees
list. Here is my code:
list<Instance*>::iterator i;
for (i = instances.begin(); i != --instances.end(); i++)
{
list<Instance*>::iterator j;
for (j = i + 1; j < instances.end(); j++)
{
// Do something!
}
}
I get a big error message at i + 1. I got a similar message when I
wrote
i != instances.end() -1, but fixed this by writing --instances.end().
My question what must I write instead of i + 1?
Thanks for listening!
Kees