摘要: 代码参考自《c++ concurrency in action》 采用纯英注释 #include <iostream> #include <thread> void f(int i, const std::string &s) { } void oops(int some_para) { char 阅读全文
posted @ 2023-01-02 22:53 啦啦啦123132 阅读(155) 评论(0) 推荐(0)
摘要: vtable and vptr 有了虚函数以后,对象所占用的存储空间比没有虚函数时多了 4 个字节。实际上,任何有虚函数的类及其派生类的对象都包含这多出来的 4 个字节,这 4 个字节就是实现多态的关键——它位于对象存储空间的最前端,其中存放的是虚函数表的地址。 每一个有虚函数的类(或有虚函数的类的 阅读全文
posted @ 2021-10-11 12:21 啦啦啦123132 阅读(177) 评论(0) 推荐(0)
摘要: ```cpp#include <iostream> char array1[] = "Foo" "bar";// same aschar array2[] = { 'F', 'o', 'o', 'b', 'a', 'r', '\0' }; const char* s1 = R"foo(Hello W 阅读全文
posted @ 2021-10-09 21:16 啦啦啦123132 阅读(187) 评论(0) 推荐(0)