lundi 20 juillet 2015

Iteration: Invalid operands to binary expression

I am trying to iterate through a set of strings, declared here:

std::set<std::string>aB;, and here std::set<int>::iterator iter;

The problem is here:

for(iter = aB.begin(); iter != aB.end(); ++iter) {
    std::cout << *iter << n;

In theory, this should print out the contents of aB (available Buildings), but instead, it gives two errors:

error: no viable overloaded '=' -> [ for(iter = aB.begin(); ]

and

error: invalid operands to binary expression -> [ std::set< int >::iterator ]

Any help would be much appreciated, thanks.

Aucun commentaire:

Enregistrer un commentaire