随笔分类 -  C/C++

1 2 下一页

C++之可变模板参数打印及Pari的逐块式构造(Piecewise Construction)
摘要:class Foo { public: Foo(tuple<int, double>) { cout << "Foo(tuple<int, double>)"<< endl; } template <typename T> void print(T t) { cout << t << endl; } 阅读全文

posted @ 2022-10-11 10:25 奔跑吧,蜗牛! 阅读(88) 评论(0) 推荐(0) 编辑

三次握手和四次挥手的通俗理解
摘要:三次握手 四次挥手 阅读全文

posted @ 2022-08-04 12:58 奔跑吧,蜗牛! 阅读(285) 评论(0) 推荐(0) 编辑

为什么拷贝构造函数的参数可以直接去访问它自己的私有成员?
摘要:为什么拷贝构造函数的参数可以直接去访问它自己的私有成员?关于对象不能直接访问私有成员的超级大误区~_Jeff_的博客-CSDN博客 关于类成员函数中访问同类对象的私有成员 - runfeel - ITeye博客 阅读全文

posted @ 2021-09-12 09:35 奔跑吧,蜗牛! 阅读(103) 评论(0) 推荐(0) 编辑

C++之forward move源码分析
摘要:/** * @brief Forward an lvalue. * @return The parameter cast to the specified type. * * This function is used to implement "perfect forwarding". */ te 阅读全文

posted @ 2021-09-11 23:11 奔跑吧,蜗牛! 阅读(138) 评论(0) 推荐(0) 编辑

C++之forward
摘要:不管是T&&、左值引用、右值引用,std::forward都会按照原来的类型完美转发。 forward主要解决引用函数参数为右值时,传进来之后有了变量名就变成了左值。 #include <QCoreApplication> #include <memory> #include <iostream> 阅读全文

posted @ 2021-09-11 22:27 奔跑吧,蜗牛! 阅读(3020) 评论(0) 推荐(0) 编辑

C++之不完整的数据类型释放
摘要:class Demo_Class; void do_delete(Demo_Class* p) { delete p; } class Demo_Class{ public: ~Demo_Class() { cout<<"析构"; } }; int main(int argc, char *argv 阅读全文

posted @ 2021-09-11 21:36 奔跑吧,蜗牛! 阅读(60) 评论(0) 推荐(0) 编辑

C++中typename关键字的使用方法和注意事项(好文收藏)
摘要:https://www.cnblogs.com/MrLiuZF/p/14062395.html 阅读全文

posted @ 2021-09-08 09:25 奔跑吧,蜗牛! 阅读(49) 评论(0) 推荐(0) 编辑

C++之左值引用和右值引用
摘要:标记下,以后整理 https://blog.csdn.net/qq_39521554/article/details/88364471 https://zhuanlan.zhihu.com/p/97128024 阅读全文

posted @ 2021-09-07 22:23 奔跑吧,蜗牛! 阅读(15) 评论(0) 推荐(0) 编辑

C++之Class内存
摘要:同一类的不同对象,在调用相同的成员函数时,他们的入口地址是否相同? 是相同的因为他们都存在了代码区 什么样的机制来保证他们同时调用的时候不冲突,并且输出是各自的结果的? 类就相当于是个空盒子,组合了this指针,才有了灵魂。 用this指针来保证他们的数据数据不发送冲突,因为传入的是不同this指针 阅读全文

posted @ 2021-09-06 00:31 奔跑吧,蜗牛! 阅读(107) 评论(0) 推荐(0) 编辑

C++ 之Const
摘要:#include "BaseClass.h" #include <iostream> using namespace std; // const只在编译期间保证常量被使用时的不变性,无法保证运行期间的行为 // 程序员直接修改常量会得到一个编译错误,但是使用间接指针修改内存,只要符合语法则不会得到任 阅读全文

posted @ 2021-09-06 00:06 奔跑吧,蜗牛! 阅读(91) 评论(0) 推荐(0) 编辑

C++之DISALLOW_COPY_AND_ASSIGN
摘要:DISALLOW_COPY_AND_ASSIGN本身是一个宏,其定义如下: // A macro to disallow the copy constructor and operator= functions // This should be used in the private: decla 阅读全文

posted @ 2021-09-03 13:13 奔跑吧,蜗牛! 阅读(618) 评论(0) 推荐(0) 编辑

C++之单参数构造函数隐式转换
摘要:1 BaseClass oBaseClass = "隐式转换构造函数调用"; 2 3 BaseClass oBaseClass2 = oBaseClass; 4 BaseClass oBaseClass3("显示调用构造函数"); 5 oBaseClass3= oBaseClass2; 6 7 au 阅读全文

posted @ 2021-09-03 12:47 奔跑吧,蜗牛! 阅读(339) 评论(0) 推荐(0) 编辑

C++之INL文件的使用
摘要:#ifndef BASECLASS_H #define BASECLASS_H #include <iostream> using namespace std; class BaseClass { public: BaseClass(); void inlineFun(); }; #include 阅读全文

posted @ 2021-09-02 20:23 奔跑吧,蜗牛! 阅读(1266) 评论(0) 推荐(0) 编辑

C++ 之头文件依赖和引用类型的成员变量
摘要:#ifndef CHILDCLASS_H #define CHILDCLASS_H class BaseClass; class ChildClass // : public BaseClass 1 需要引入头文件 { public: ChildClass(BaseClass oBase); Bas 阅读全文

posted @ 2021-09-02 20:10 奔跑吧,蜗牛! 阅读(198) 评论(0) 推荐(0) 编辑

注册表在64位操作系统下
摘要:使用RegOpenKeyEx打开HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run 成功,RegQueryValueEx 失败。又随便换了几个位置的键读取,同样的代码有的成功,有的失败。逐一确认不知权限的问题。网 阅读全文

posted @ 2019-09-17 13:54 奔跑吧,蜗牛! 阅读(1479) 评论(0) 推荐(0) 编辑

C++之private虚函数
摘要:一般我们说虚函数,它的访问级别都是public的,用类对象可以直接调用,这样就可以实现运行时的类型绑定,那如果我们将虚函数私有化会出现什么情况呢?是不是很蛋疼的想法。#include class Derived; class Base { public: void doFun() { fun(); } private: virtual void fun() { std::co... 阅读全文

posted @ 2019-03-13 10:50 奔跑吧,蜗牛! 阅读(1754) 评论(0) 推荐(0) 编辑

linux launch failed.binary not found Linux
摘要:Linux 不需要装MinGW,需要设置两个地方 1 Project->Properties->C\C++ Build->Settings->在右边选择Binary Parsers->勾选GUN ELF Parser然后右下角点Apply and Close; 2 Project->Properti 阅读全文

posted @ 2018-08-29 13:09 奔跑吧,蜗牛! 阅读(755) 评论(0) 推荐(0) 编辑

C++11 占位符placeholders和函数bind用法
摘要:#include #include #include using namespace std; using namespace std::placeholders; void test(int i, double d, const string &s) { cout fp; string s = "foo"; int a = 3; double b =... 阅读全文

posted @ 2018-08-20 13:45 奔跑吧,蜗牛! 阅读(6195) 评论(0) 推荐(0) 编辑

C++11 function函数用法
摘要:// C++11 function #include void print_num(int i) { std::cout getSum = [&](const int &nI1, const int &nI2) { int nSum = nI1 + nI2; std::cout f_display_42 = []() { print_num(42); }; f_displa... 阅读全文

posted @ 2018-08-20 13:25 奔跑吧,蜗牛! 阅读(10223) 评论(0) 推荐(1) 编辑

placement new的用法及用途
摘要:什么是placement new?所谓placement new就是在用户指定的内存位置上构建新的对象,这个构建过程不需要额外分配内存,只需要调用对象的构造函数即可。举例来说:class foo{};foo* pfoo = new foo;pfoo指向的对象的地址你是不能决定的,因为new已经为你做 阅读全文

posted @ 2018-08-20 12:03 奔跑吧,蜗牛! 阅读(7273) 评论(0) 推荐(2) 编辑

1 2 下一页
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

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