c++17 auto非类型模板参数
//用auto非类型模板参数 #include <iostream> using namespace std; template<auto c> auto foot() { cout << c << endl; return c; } int main4() { foot<312>(); int m = 12; switch (m) { case 0: cout << "switch0" << endl; [[fallthrough]]; case 1: cout << "switch1" << endl; [[fallthrough]]; case 2: cout << "switch2" << endl; [[fallthrough]]; default: cout << "default" << endl; [[fallthrough]]; break; } //if中嵌入表达式 if (int m = 23; m > 24) { cout << "m<<" << m << endl; } //相比较c++ 11 constexptr 扩展作用范围 if constexpr (constexpr int m = 23; m < 2433) { } return 0; }