lundi 29 juin 2015

c++11 chrono unreferenced local variable

When I use the following code to perform some action for 1 second, I get a C4101 warning from Visual Studio: warning C4101: 'highResClock' : unreferenced local variable. I don't understand why I get this warning when I use highResClock twice after declaring it.

chrono::high_resolution_clock highResClock;
chrono::duration<int, ratio<1, 1> > dur(1);
chrono::time_point<chrono::high_resolution_clock> end = highResClock.now() + dur;

while (highResClock.now() < end)
{
    // do something repeatedly for 1 second
}

Aucun commentaire:

Enregistrer un commentaire