1. 概述 STL Allocator是STL的内存管理器,也是最低调的部分之一,你可能使用了3年stl,但却不知其为何物. STL标准如下介绍Allocator the STL includes some low-level mechanisms for allocating and deallocating memory. Allocators are very specialized, and you can safely ignore them for almost all purpos…
在C语言中,我们写程序时,总是会有动态开辟内存的需求,每到这个时候我们就会想到用malloc/free 去从堆里面动态申请出来一段内存给我们用.但对这一块申请出来的内存,往往还需要我们对它进行稍许的“加工”后即初始化 才能为我们所用.尽管申请的内存没有初始化,编译器也不会报错.但为保持良好的编程习惯,我们都应该对申请出来的内存作手动进行初始化. 对此,这难免会有些繁琐,于是C++有了new/delete, new []/delete[] 来进行动态内存管理. [new/delete, new […