RT,应该算 c++ 语法问题
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d;
struct ED{
int* begin(){
return &d;
}
int* end(){
return &a;
}
}arr;
int main(){
for(auto it = arr.begin();it != arr.end();it++){
cerr<<it<<" compare "<<arr.end()<<endl;
cerr<<" ? "<<(it == arr.end())<<endl;
for(int j = 1;j <= 1e6;j++)rand();
}
return 0;
}
关于为什么 begin,end 是反过来的,因为 -O2 确实会反过来,反回来也试过了,依旧死循环。
调试中出现了 0x140010040 compare 0x140010040 ? 0 的情况,意思是两个值不一样,这是为什么捏。(会和 -O2 相关吗)
求助各位巨佬(