As the compiler says, you are trying to perform this operation.
__gnu_cxx::__normal_iterator<xyz**, std::vector<xyz*,std::allocator<xyz*> > >*&
&&
__gnu_cxx::__normal_iterator<xyz**,std::vector<xyz*, std::allocator<xyz*> > >&
and the only available one is:
gnu.cpp:14: candidates are: operator&&(bool, bool) <built-in>
How do you propose to convert from an iterator to bool?
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int>::iterator p;
if (&p) cout << "Pointer OK\n";
if (p) cout << "Compiler will balk here - can't convert iter to bool\n";
if (&p && p) cout << "Compiler will balk here, too, with the error above\n"
}
not to mention the fact that you are dereferencing a NULL pointer (through *p) which will result in undefined behaviour if at runtime you actually got to the bool(*p) bit.
You could get around this through operator overloading (which will be both error prone and most likely needlessly complex), however I have to ask why you are using pointers to iterators - what is wrong with just using an iterator?