- 博客(2)
- 收藏
- 关注
原创 c++可调用对象之lambda
lambda 表达式形式: [capture list](parameter list) -> return type{function body} 其中:capture list为捕获列表,parameter list为参数列表,reuturn type为返回类型,function body为函数体。 示例 auto f=[]{return 42;}; auto f=[=,&os](const vstring& s)->bool {os<<s<<c;}
2020-08-29 16:06:47 364
原创 C++ auto & decltype
C++ auto & decltype auto 要点: auto会忽略顶层const(顶层const即用来修饰对象本身,与之对应的有底层const,代码片中有分析) 可以在auto的基础上添加const或&来修饰对象 #include <iostr1eam> using namespace std; int main() { const int a=10; //该const为顶层const,不能修改对象a的值 const int* p=&a //该const
2020-08-10 10:25:19 95 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人