上一页 1 2 3 4 5 6 7 8 ··· 112 下一页
摘要: default(Defaulted Function) 编译器创建此函数的默认实现 默认函数需要用于特殊的成员函数(默认构造函数,复制构造函数,析构函数等) delete(expicitly deleted) 禁用成员函数使用 通常是针对隐式函数 class A { public: A() = de 阅读全文
posted @ 2022-09-01 15:13 thomas_blog 阅读(58) 评论(0) 推荐(0) 编辑
摘要: Code::Blocks Dev-C++ clion C-Free 阅读全文
posted @ 2022-08-25 19:34 thomas_blog 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 至少有一个纯虚函数 不能生成对象 模拟方法 构造和拷贝构造都使用protected修饰 析构函数设置为纯虚函数 析构函数使用protected修饰 阅读全文
posted @ 2022-08-25 13:31 thomas_blog 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #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 阅读(13) 评论(0) 推荐(0) 编辑
摘要: #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 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #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 阅读(26) 评论(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 阅读(17) 评论(0) 推荐(0) 编辑
摘要: #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 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 原子操作指“不可分割的操作”,一般针对一个变量 互斥量一般针对代码段 #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 阅读(311) 评论(0) 推荐(0) 编辑
摘要: #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 阅读(84) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 112 下一页