vector.size() 別名 size_type を扱うときに、この奇妙な比較を明確にするのに少し助けが必要です
vector<cv::Mat> rebuiltFaces;
int rebuildIndex = 1;
cout << "rebuiltFaces size is " << rebuiltFaces.size() << endl;
while( rebuildIndex >= rebuiltFaces.size() ) {
cout << (rebuildIndex >= rebuiltFaces.size()) << " , " << rebuildIndex << " >= " << rebuiltFaces.size() << endl;
--rebuildIndex;
}
そして、コンソールから得られるのは
rebuiltFaces size is 0
1 , 1 >= 0
1 , 0 >= 0
1 , -1 >= 0
1 , -2 >= 0
1 , -3 >= 0
推測する必要がある場合、コンパイラはrebuildIndexを盲目的にunsignedと+-にキャストしていますが、奇妙な動作を引き起こしていると言えますが、よくわかりません。誰か知っていますか?