jeudi 26 novembre 2015

c++ compare vector

I am trying to compare a string in a vector to another string:

I tried:

vector<string> x;
string y;

if(x[i] == y)
if(x[i].compare(y) == 0)
if(y.compare(x[i]) == 0)
if(x.at(i) == y)
if(x.at(i).compare(y) == 0)
if(y.compare(x.at(i)) == 0)

tried passing x[i] / x.at(i) to string z first, nothing. I get no compile errors, no problems, it just seems the vector at index i does not want to compare?

g++ -v 4.9.3
Windows 7: cygwin64
c++11, compiling using the -std=c++11 call

Aucun commentaire:

Enregistrer un commentaire