会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Thomas's Blog
吾尝终日而思矣
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
111
下一页
2022年9月1日
C++中 =default和=delete
摘要: default(Defaulted Function) 编译器创建此函数的默认实现 默认函数需要用于特殊的成员函数(默认构造函数,复制构造函数,析构函数等) delete(expicitly deleted) 禁用成员函数使用 通常是针对隐式函数 class A { public: A() = de
阅读全文
posted @ 2022-09-01 15:13 thomas_blog
阅读(94)
评论(0)
推荐(0)
2022年8月25日
C++开发工具
摘要: Code::Blocks Dev-C++ clion C-Free
阅读全文
posted @ 2022-08-25 19:34 thomas_blog
阅读(32)
评论(0)
推荐(0)
C++抽象类
摘要: 至少有一个纯虚函数 不能生成对象 模拟方法 构造和拷贝构造都使用protected修饰 析构函数设置为纯虚函数 析构函数使用protected修饰
阅读全文
posted @ 2022-08-25 13:31 thomas_blog
阅读(30)
评论(0)
推荐(0)
2022年8月19日
异常处理 try catch
摘要: #include <iostream> using namespace std; void func(int a) { if(a == 0) { throw string("a is error"); throw a; } } int main() { try { func(0); } catch(
阅读全文
posted @ 2022-08-19 08:41 thomas_blog
阅读(20)
评论(0)
推荐(0)
2022年8月18日
assert
摘要: #include <iostream> //#define NDEBUG //发行版本中,assert都会被关掉 #include <assert.h> int main() { int i = 10; assert(i > 20); return 0; } a.out: assert.cpp:7:
阅读全文
posted @ 2022-08-18 19:41 thomas_blog
阅读(71)
评论(0)
推荐(0)
2022年8月17日
C++ typeid获取类型信息
摘要: #include <iostream> #include <typeinfo> int main() { int i; const std::type_info &info = typeid(int); std::cout << "typeid " << info.name() << std::en
阅读全文
posted @ 2022-08-17 08:40 thomas_blog
阅读(41)
评论(0)
推荐(0)
虚函数表构建时机
摘要: #include <iostream> class Base { public: Base() { func(); } ~Base() { func(); } virtual void func() { std::cout << "Base func" << std::endl; } }; clas
阅读全文
posted @ 2022-08-17 07:48 thomas_blog
阅读(32)
评论(0)
推荐(0)
2022年8月13日
C++ timed_mutex
摘要: #include <iostream> #include <thread> #include <mutex> std::timed_mutex mutex; void mythread() { std::chrono::milliseconds timeout(100); //100ms std::
阅读全文
posted @ 2022-08-13 13:16 thomas_blog
阅读(87)
评论(0)
推荐(0)
2022年8月11日
C++原子操作atomic
摘要: 原子操作指“不可分割的操作”,一般针对一个变量 互斥量一般针对代码段 #include <iostream> #include <thread> #include <atomic> std::atomic<int> atomic; void add() { for(int i = 0; i < 10
阅读全文
posted @ 2022-08-11 19:17 thomas_blog
阅读(346)
评论(0)
推荐(0)
2022年8月8日
C++ shared_future
摘要: #include <iostream> #include <future> int mythread() { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::chrono::milliseconds
阅读全文
posted @ 2022-08-08 19:12 thomas_blog
阅读(113)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
111
下一页
公告