摘要: decltype 说明符(C++11) C++11 引入了 decltype 说明符,decltype 可以获取一个对象或者表达式的类型。 使用起来也很简单: #include <iostream> int main() { int x1 = 0; decltype(x1) x2 = 0; // x 阅读全文
posted @ 2022-09-07 23:25 machine_gun_lin 阅读(175) 评论(0) 推荐(0)
摘要: 使用 auto 关键字自动推导变量类型(C++11) C++11 允许使用 auto 关键字对变量类型进行自动推导,通常用在变量类型较长或者很难写出变量类型的场景。 来看一个例子: #include <iostream> #include <string> #include <vector> #in 阅读全文
posted @ 2022-09-07 00:02 machine_gun_lin 阅读(78) 评论(0) 推荐(0)