摘要: #include <vector> #include <iostream> using namespace std; int main() { int ia[] = {1, 2, 3}; vector<int> ivec(ia, ia + sizeof(ia) / sizeof(int)); for 阅读全文
posted @ 2020-07-07 19:57 wsl96 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1.new、delete、malloc、free关系 delete会调用对象的析构函数,和new对应free只会释放内存,new调用构造函数。malloc与free是C++/C语言的标准库函数,new/delete是C++的运算符。它们都可用于申请动态内存和释放内存。对于非内部数据类型的对象而言,光 阅读全文
posted @ 2020-07-07 18:21 wsl96 阅读(162) 评论(0) 推荐(0) 编辑