dimanche 16 juillet 2017

c++11 please explain this unused variable

I really dont understand why i getting a unused variable complaint with this code, while r is used to create a string :

for (auto &r : ranges) {
        for (int j =1; j<=8; j++) {
            for (int x=1; x<=56; x++) {
                tempRange = r + "." + std::to_string(j) + "." + std::to_string(x);
                std::cout << "Going to harvest " << tempRange << std::endl;
                //h.connectTo(tempRange);
                totalCount++;
            }
        }
    }   

output :

main.cpp:90:16: warning: unused variable ‘r’ [-Wunused-variable]
     for (auto &r : ranges) {

Aucun commentaire:

Enregistrer un commentaire