error: no match for operator !

While tried to compile following code on linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
bool CProcess :: matchPattern (vector<string> pattern, bool exact)
{
  bool match = false;

  vector<string>::iterator i;
  vector<string>::iterator j;

  i = pattern.begin();
  j = nameandargs.begin();

  if (i == pattern.end() || !j )
  {
    return (match);
  }
}


But i get following error:

error: no match for operator! in !j


Can anyone explain why i am getting this error..
Simple, vector<string>::iterator has no operator!, nor is it convertible to bool.
Perhaps you should explain why you think that it should somehow work and more importantly, what you are trying to do in the first place.
Last edited on
Yeah Athar i agree with you but same code get compiled on solaris but not on linux.
I not understanding this part.
Not all implementations of the standard library are standard-compliant.
Check the iterator source code to see why it compiles and how it is implemented.
Topic archived. No new replies allowed.