09 2022 档案
摘要:类的建立一般是有两种方式。 1.静态建立方式 A a1; 栈上分配内存,然后调用构造函数,直接调用了类的构造函数。 2.动态建立方式 A* p=new A; 使用new运算符将对象建立在堆空间中,a.首先调用operator new函数,在堆上进行分配 b.调用构造函数构造对象。间接调用类的构造函数
阅读全文
摘要:【转载】本文为CSDN博主「danxibaoxxx」的原创文章 原文链接:https://blog.csdn.net/danxibaoxxx/article/details/94445666 函数的返回值保存在内存的什么区域呢? 1、结构体大小不超过4字节,那么仍然使用EAX寄存器传递返回值 2.结
阅读全文
摘要:[C++ priority_queue的自定义比较方式] #include<queue> #include<vector> #include<iostream> using namespace std; struct node { int x, y; node(int x, int y) :x(x)
阅读全文
摘要:lowbit 在计算数字二进制表示中有多少个1的时候,可以使用lowbit来表示。每次找到数的最后一个1的大小。 x&(-x) 具体代码为 int num1count(int x) { int m = 0; for (; x; x -= x & (-x)) { m++; } return m; }
阅读全文