g++ c++11 c++0x

g++要想支持c11的话,编译时

g++ -o t test.cpp -std=c++0x

g++ -o t test.cpp -std=c++11

#include <iostream>
#include <array>

using namespace std;

int main() {
    array<int, 10> a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    a[0] = 22;
    cout<<a.at(0)<<endl;
    cout<<a.back()<<endl;
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/longchang/p/12899431.html