会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
唯一诺
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
18
下一页
2021年4月6日
两个数之和等于target值
摘要: void checkTarget() { int target = 14; int buf[] = { 8, 2, 9, 10, 5, 4, 6 }; std::map<int, int> tmpMap; for (int i = 0; i < sizeof(buf); i ++) { std::m
阅读全文
posted @ 2021-04-06 08:34 唯一诺
阅读(118)
评论(0)
推荐(0)
2021年3月31日
c++为什么使用初始化列表效率高
摘要: class CSub2 { public: CSub2() { cout << "默认构造函数:" << this <<endl; } CSub2(int x) : m_x(x) { cout << "构造函数:" << m_x << ":" << this << endl; } CSub2& op
阅读全文
posted @ 2021-03-31 21:03 唯一诺
阅读(416)
评论(0)
推荐(0)
c++中的trivial destructor是什么
摘要: https://blog.csdn.net/wudishine/article/details/12307611
阅读全文
posted @ 2021-03-31 19:19 唯一诺
阅读(196)
评论(0)
推荐(0)
2021年3月30日
Valgrind工具如何使用
摘要: 11
阅读全文
posted @ 2021-03-30 20:13 唯一诺
阅读(51)
评论(0)
推荐(0)
C++Template学习
摘要: template<typename T> void funcTmp(T a, T b) { cout << "this is yiban" << endl; } template<> void funcTmp(const char* a, const char* b) { cout << "this
阅读全文
posted @ 2021-03-30 19:27 唯一诺
阅读(59)
评论(0)
推荐(0)
c++中必须使用初始化列表初始化的的四种情况
摘要: 1. 必须使用初始化列表初始化一个引用成员; class CBase { public: CBase(int a) : m_a(a) //正确,m_a是一个变量的引用,必须通过初始化列表初始化 { // m_a = a; //错误 cout << "m_a:" << m_a << endl; } p
阅读全文
posted @ 2021-03-30 19:24 唯一诺
阅读(1861)
评论(0)
推荐(0)
2021年3月29日
c++中的内存管理【转载】
摘要: https://chenqx.github.io/2014/09/25/Cpp-Memory-Management/
阅读全文
posted @ 2021-03-29 08:54 唯一诺
阅读(51)
评论(0)
推荐(0)
2021年3月27日
c++中dynamic_cast、static_cast、reinterpret_cast和const_cast作用
摘要: 1. static_cast用法:static_cast < type-id > ( exdivssion ) 该运算符把exdivssion转换为type-id类型,但没有运行时类型检查来保证转换的安全性。它主要有如下几种用法:① 用于类层次结构中基类和子类之间指针或引用的转换。 进行上行转换(把
阅读全文
posted @ 2021-03-27 10:54 唯一诺
阅读(124)
评论(0)
推荐(0)
2021年3月26日
c++中的顶层const和底层const
摘要: 什么是顶层和底层const: 1. 顶层const:指const定义的变量本身是一个常量; 2. 底层const:指const定义的变量所指向的对象是一个常量; const int i = 0; //顶层const,变量i就是常量; const int * a = &i; //底层const, a所
阅读全文
posted @ 2021-03-26 08:57 唯一诺
阅读(462)
评论(0)
推荐(1)
2021年3月25日
c++赋值操作符需要确保自我赋值的安全性问题
摘要: class tmp { public: int a; int b; }; class ctest { public: ctest() { p = new tmp; } ~ctest() { delete p; } ctest& operator = (const ctest& t) { tmp *
阅读全文
posted @ 2021-03-25 20:26 唯一诺
阅读(104)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
18
下一页
公告