I want to loop through a nested vector, ignoring the object that the outer loop is currently at. Note: this code is just a brief draft of my program, so as not to cause confusion with my current implementation.
class A
{
public:
int no;
}
class B: public A
{
}
class C: public A
{
}
vector<A*> objects;
for(vector<A*>::iterator it1 = objects.begin(); it1 != objects.end(); ++it1)
{
for(vector<A*>::iterator it2 = objects.begin(); it2 != objects.end(); ++it2)
{
if((*it1)->no == (*it2)->no)
{
cout << "matched";
}
else
{
cout << "no match";
}
}
}
So, I want to loop through the inner loop it2, NOT checking the object at it1.
Aucun commentaire:
Enregistrer un commentaire