01 2021 档案

摘要:在C++中,内存被分成5个区,他们分别是堆、栈、自由存储区、全局/静态存储区、和常量存储区。 栈(Stack),在执行函数时,函数内部局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元被释放。栈的内存分配预案算内置于处理器指令集中,效率很高,但是分配的内存容量有限。 堆(Heap),就是 阅读全文
posted @ 2021-01-23 01:20 zengzhaocheng 阅读(61) 评论(0) 推荐(0)
摘要:函数模板的定义可以用来作为一个无限个函数实例集合定义的规范描述(prescription)。模板本身不能定义任何函数。例如,当编译器实现看到下面的模板定义时 template <typename Type> Type min(Type t1,Type t2) { return t1<t2?t1:t2 阅读全文
posted @ 2021-01-23 01:09 zengzhaocheng 阅读(70) 评论(0) 推荐(0)
摘要:C++ 有几个特定的区域用来存储对象或非对象值,每个区域有其各自的特点。 https://stackoverflow.com/questions/14588767/where-in-memory-are-my-variables-stored-in-c Global variables > data 阅读全文
posted @ 2021-01-23 01:06 zengzhaocheng 阅读(270) 评论(0) 推荐(0)
摘要:int i = 10; vector <pair<pair<int, int>, int>> grid; grid.push_back(make_pair<pair<int, int>, int>(make_pair<int, int>(i, 2), 2));//make_pair处报错:没有与参数 阅读全文
posted @ 2021-01-16 00:34 zengzhaocheng 阅读(258) 评论(0) 推荐(0)