RT
有如下代码:
#include <iostream>
using namespace std;
int main() {
int a[5] = {5, 4, 3, 2, 1};
sort(a, a + 5);
for (int i = 0; i < 5; i++) {
cout << a[i] << " ";
}
do {
cout << endl;
for (int i = 0; i < 5; i++) {
cout << a[i] << " ";
}
} while (next_permutation(a, a + 5));
cout << endl;
return 0;
}
用g++编译:
test.cpp: In function 'int main()':
test.cpp:7:3: error: 'sort' was not declared in this scope
sort(a, a + 5);
^~~~
test.cpp:7:3: note: suggested alternative: 'qsort'
sort(a, a + 5);
^~~~
qsort
test.cpp:16:12: error: 'next_permutation' was not declared in this scope
} while (next_permutation(a, a + 5));
但是在clang里面,压!根!不!报!错!
于是我在机房开心的考试成绩,100->0
QAQAQAQAQAQAQAQAQAQAQAQ
(或者说我用msys2下的是个假clang?)
可是我舍不得我亲爱的clangd和vim