auto
先看一个Qt运行的例子
Qt_xx.pro
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
#include <iostream>
using namespace std;
auto func(int i) {
return i;
}
int main() {
cout << func(4) << endl;
return 0;
}
\cpp14_auto\main.cpp:5: error: ‘func’ function uses ‘auto’ type specifier without trailing return type
auto func(int i) {
加入C++14
Qt_xx.pro
```bash
TEMPLATE = app
CONFIG += console c++11 c++14
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp