panthro
panthro

Reputation: 24089

Declaring a var?

What type is it? It says I need to declare it.

Recording Array is: std::vector<std::pair<int, QString> > recordingArray;

string line = "";
auto it = recordingArray.begin();

while(it != recordingArray.end())
{
  line.append(*it);
  line.append(',');
}

Also, it's not auto type.

Upvotes: 1

Views: 123

Answers (2)

Fantastic Mr Fox
Fantastic Mr Fox

Reputation: 33944

it will be a std::vector<*TheTypeInArray*>::iterator. So you can either declare it as that or enable c++11 support so you can use auto.

Upvotes: 1

fredoverflow
fredoverflow

Reputation: 263320

The type is std::vector<std::pair<int, QString> >::iterator, which the compiler should be able to figure out. If this doesn't work with auto, you need to enable C++11 support in your compiler, for example with -std=c++0x in g++ and clang. (The meaning of auto changed from C++03 to C++11).

Upvotes: 6

Related Questions