user3290184
user3290184

Reputation: 17

Error: no match for 'operator!='

void super::findTarget(list<int>Dlist,list<super>::iterator t){

while(t != Dlist.end()){
 double mypos[3];
 double target[3];
 double fpos[3];
 double speed;
 double range;
 double a, b, c, D;

 mypos[0]=this->x;
 mypos[1]=this->y;
 mypos[2]=this->z;
 range = this->range;

 target[0]=t->x;
 target[1]=t->y;
 target[2]=t->z;

 a = target[0]-mypos[0];
 b = target[1]-mypos[1];
 c = target[2]-mypos[2];

 D = sqrt( pow(a,2.0)+pow(b,2.0)+pow(c,2.0));
 Dlist.push_back(D);
   };
};

On the 2nd line, while (t != Dlist.end(){, I'm getting the following error:

C:\Users\Daniel\Desktop\project\super.cpp|369|error: no match for 'operator!=' in 't != Dlist.std::list<_Tp, _Alloc>::end >()'|

Am I just not allowed to do this inside of a function or am I missing something?

Upvotes: 0

Views: 13122

Answers (2)

Hey
Hey

Reputation: 1841

I think you shouldn't compare a list<int>::iterator and a list<super>::iterator. There is no != operator that takes those two different types as arguments.

Upvotes: 1

NathanOliver
NathanOliver

Reputation: 180998

A list<int> and list<super> are two different list. You cannot compare an iterator from one to an iterator from the other.

Upvotes: 4

Related Questions