摘要: lambdas 类似于一种 inline function,能被当作是一种参数或是一种局部对象。 看到中括号开头的那就是 lambda 啦~~~ [] { std::cout << "hello lambda!" << std::endl; }; [] { std::cout << "hello l 阅读全文
posted @ 2020-11-19 16:26 Codroc 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 红色 绿色 蓝色 Initializer List An initializer list forces so-called value initialization, which means that even local variables of fundamental types, which 阅读全文
posted @ 2020-11-19 16:17 Codroc 阅读(170) 评论(0) 推荐(0) 编辑
摘要: explicit for ctors taking more than one argument struct Complex{ double _real; double _i; Complex(double real, double i = 0) : _real(real), _i(i){} // 阅读全文
posted @ 2020-11-19 16:00 Codroc 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Rvalue references (右值引用) and Move Semantics Rvalue references are a new reference type introduced in C++0x that help solve the problem of unnecessary 阅读全文
posted @ 2020-11-19 15:31 Codroc 阅读(99) 评论(0) 推荐(0) 编辑
摘要: range-based for statement for(decl : coll){ // decl:声明 coll:容器 statement } for(int i : {2, 3, 4, 5, 6}){ cout << i << endl; } vector<double> vec; ··· 阅读全文
posted @ 2020-11-19 11:50 Codroc 阅读(86) 评论(0) 推荐(0) 编辑
摘要: Automatic Type Deduction with auto With C++11, you can declare a variable or an object without specifying its type by using auto. For example: auto i 阅读全文
posted @ 2020-11-19 11:29 Codroc 阅读(76) 评论(0) 推荐(0) 编辑