for循环使用size_t递减时的注意事项 size_t范围是大于0的,如果结界i>=0时,i–最后不会变为负数,而是变为size_t最大值 即如果写成如下形式,会导致无限循环。 for (size_t i = 10; i >= 0; i--) { cout << i << endl; }