Karhunen
Karhunen

Reputation: 185

Error using QVectorIterator

I have a strange problem with a QVectorIterator

I try the example they provide:

 QVector<float> vector;
 QVectorIterator<float> i(vector);
 while (i.hasNext())
     qDebug() << i.next();

but it won't compile, it says :

vector is not a type

. Do you know why ?

Thank you

Upvotes: 1

Views: 686

Answers (1)

anydot
anydot

Reputation: 1539

You probably have something like:

using namespace std;

above. As part of std namespace there's templated class std::vector so your declaration causes nameclash since you are trying to name your variable with name already used by class. To solve it either remove using namespace std (but then you would need to always fully qualify everything from std namespace) or just choose some other name for your variable.

Upvotes: 2

Related Questions