我试图编译这段代码(在test.cpp文件中)
#include<tuple>
int main(){
auto [c,d] = make_tuple(3.1,2.3);
}
Run Code Online (Sandbox Code Playgroud)
使用
g++ -std=c++17 test.cpp -o test
,以及
clang++ -std=c++1z test.cpp -o test
两者都会打印错误信息:
test.cpp: In function ‘int main()’:
test.cpp:3:7: error: expected unqualified-id before ‘[’ token
auto [c,d] = make_tuple(3.1,2.3);
Run Code Online (Sandbox Code Playgroud)
使用g ++(Ubuntu 5.4.0-6ubuntu1~16.04.9)5.4.0 20160609和clang版本3.8.0-2ubuntu4(使用Ubuntu 16.04.09)我缺少什么?