You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The program is normal under the clang compiler, but on vc2019, Microsoft will report an error on the judgment condition of your "for" statement. If the judgment of the maximum pointer of the iterator exceeds the error, the debug channel will report an error, and the output of the Release channel will be abnormal.
Assuming the string length is "length", then it is normal when you execute begin+length<end, but after each round of the loop, the pointer is shifted back by 3 bits, then begin+length+1<end and begin+length+2<end two judgment statements will report an error.
I have a solution:
Change for (auto it = begin; it < end; it += 3) {
to
auto length = end - begin;
for (auto i = 0; i < length; i += 3) {
auto it = begin + i;
Change
if (it + 1 < end) {
if (it + 2 < end) {
to
if (i + 1 < length) {
if (i + 2 < length) {
Personally think this is the easiest solution.
The text was updated successfully, but these errors were encountered:
Expression: cannot seek string iterator after end
The program is normal under the clang compiler, but on vc2019, Microsoft will report an error on the judgment condition of your "for" statement. If the judgment of the maximum pointer of the iterator exceeds the error, the debug channel will report an error, and the output of the Release channel will be abnormal.
Assuming the string length is "length", then it is normal when you execute
begin+length<end
, but after each round of the loop, the pointer is shifted back by 3 bits, thenbegin+length+1<end
andbegin+length+2<end
two judgment statements will report an error.I have a solution:
Change
for (auto it = begin; it < end; it += 3) {
to
Change
to
Personally think this is the easiest solution.
The text was updated successfully, but these errors were encountered: