随笔分类 -  C++

摘要:这里有一篇比较好的介绍文章,作为保留。 Understanding the C++ ABI Breakage debate 阅读全文
posted @ 2023-12-10 11:23 yangbofun 阅读(12) 评论(0) 推荐(0) 编辑
摘要:在实际生产环境中,遇到使用map还是unordered_map的场景。 一方面,有unordered_map需要自定义hash函数,导致构建时比较复杂。而map使用的是比较运算符来判断元素在map中的位置,std::vector有比较运算符,所以构建map比较简单。 另一方面,unordered_m 阅读全文
posted @ 2023-04-15 13:11 yangbofun 阅读(305) 评论(0) 推荐(0) 编辑
摘要:github链接:https://github.com/yangbofun/Cpp2.0_new_features/tree/main/src/cpp11 C++11新增加特性 1. =default,delete =default 如果我们没有定义构造函数,C++编译器会自动为我们创建一个默认构造 阅读全文
posted @ 2023-03-19 19:55 yangbofun 阅读(95) 评论(0) 推荐(0) 编辑
摘要:在C++11中充斥着大量的enable_if, 那么enable_if是什么呢,为何要引入它呢,它有什么作用呢,,,, 在这之前,我们先了解下C++模板推导的机理。 1. 前序:C++模板推导机理 模板推导过程中,编译器会根据具体调用时的类型,来进行模板推导,并找出最适合的一个模板,注意是最适合的, 阅读全文
posted @ 2020-09-20 22:25 yangbofun 阅读(3454) 评论(0) 推荐(0) 编辑
摘要:先看一个例子: #include <numeric> #include <vector> #include <algorithm> #include <iterator> #include <thread> #include <iostream> #include <functional> usin 阅读全文
posted @ 2020-07-03 23:16 yangbofun 阅读(252) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示