Hi everyone,
I'm trying to compare list iterators:

list<int> l;
list<int>::iterator lb = l.begin();
list<int>::iterator le = l.end();
if (lb < le) //here I'm getting error - no operator match these operands:
{
//do something
}

And when I change this that instead of list I have vector everything works as intended. Is there any restriction on list operators?
Looking forward to your answers.
Thank you

There are different iterator categories. The iterators for a vector are the most flexible and they are called random access iterators. Lists use bidirectional iterators, and those do not support comparing with less.

Thanks TomGunn.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.