如何解决g ++默认cpp标准
$ g++ -dM -E -x c++ /dev/null | grep -F __cplusplus
#define __cplusplus 201402L
$ g++ --version
g++ (GCC) 9.3.0
Copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
->根据上面的输出,我应该使用c ++标准14的g ++,所以如果我不传递-std = c ++ 17之类的东西,那么它应该使用cpp14,不是吗?
/* C++11 and C++14 */
auto i {10}; // i has type std::initializer_list<int> !!!
/* C++17 and later */
auto i {10}; // i has type int
但是 当我尝试
auto i{10};
cout << typeid(i).name() << endl;
我知道了
$ ./a.exe
i
这表明我已被选择为int而不是std :: initializer_list类型
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。