![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
日尼禾尔_怪怪
nil
展开
-
C++:全排列函数next_permutation()和prev_permutation()
文章目录前言一、next_permutation()用法二、prev_permutation()用法总结前言字节三面,考了leetcode556题,复盘发现了两个超好用的函数,C++STL中的全排列函数为两个:next_permutation和prev_permutation其中:next_permutation实现升序,而prev_permutation实现降序。一、next_permutation()用法二、prev_permutation()用法总结学习永无止境!...原创 2020-09-27 22:24:27 · 2610 阅读 · 0 评论 -
C++:构造函数、拷贝构造、赋值运算符重载、析构函数的调用
文章目录前言一、MyClass temps = show(5);发生了什么二、 MyClass temps; temps= show(5);发生了什么总结前言整理一波构造函数、拷贝构造、赋值运算符重载、析构函数的调用,笔试题目里经常有,本文后面会贴一些同类型文章链接,方便查阅。一、MyClass temps = show(5);发生了什么以下是测试代码:#include <iostream>#include <fstream>using namespace s.原创 2020-09-15 21:56:22 · 143 阅读 · 0 评论 -
C++:内存管理——精简版
文章目录前言一、四个层面的基本用法1.1 malloc1.2 new/delete1.3 ::operator new/::operator delete1.4 C++标准库提供的allocators1.5 调用顺序及关联二、G2.9 std::alloc运行模式(经典)2.1 特点2.2 内嵌指针embedded pointers2.3 详细过程三、 malloc/free3.1、vc6内存分配3.11分配3.12释放3.13再分配3.2、内存管理之区域合并3.3、总结总结前言上一篇的精简版,方便.原创 2020-09-14 12:29:29 · 347 阅读 · 0 评论 -
C++:内存泄漏的八种情况
文章目录前言1、在类的构造函数和析构函数中没有匹配的调用new和delete函数2、使用步骤3、读入数据前言转一波大佬的内存泄漏的情况总结,之后会继续补充的1、在类的构造函数和析构函数中没有匹配的调用new和delete函数两种情况下会出现这种内存泄露:一是在堆里创建了对象占用了内存,但是没有显示地释放对象占用的内存;二是在类的构造函数中动态的分配了内存,但是在析构函数中没有释放内存或者没有正确的释放内存2、使用步骤代码如下(示例):import numpy as npimport转载 2020-09-13 15:58:37 · 875 阅读 · 0 评论 -
C++:public、protected、private继承后的访问权限
https://blog.csdn.net/casky237/article/details/54766881?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.channel_param原创 2020-09-01 13:28:59 · 297 阅读 · 0 评论 -
C++:子类与父类构造与析构的调用时机
文章目录一、引言二、代码一、引言构造子类对象时,先调用父类构造函数,再调用子类构造函数(构造函数没有虚函数这一说)析构子类对象时,先调用子类析构函数,再调用父类析构函数(无论父类的析构函数是否为虚函数)析构子类构造的父类对象时,若父类是虚函数,则先调用子类析构函数,再调用父类析构函数析构子类构造的父类对象时,若父类不是虚函数,则只调用父类析构函数二、代码#include <algorithm>#include <iostream>#include <fs原创 2020-08-29 21:21:56 · 1879 阅读 · 0 评论 -
C++:内存释放的一些小记录(测试向)
目录1、函数申请内存未释放调用函数,函数申请内存不释放调用函数,函数申请内存释放2、函数申请内存返回指针调用函数,函数申请内存不释放调用函数,函数申请内存不释放,在“主函数”释放3、将指针放在类中1、函数申请内存未释放调用函数,函数申请内存不释放 void fun() { int* test = new int(0); return; }int main() { fun(); system("pause"); return 0;}调用函数,函数申请内存释放#include原创 2020-08-24 15:52:41 · 352 阅读 · 0 评论 -
C++:c++11新特性
目录严禁、环境与资源严禁、环境与资源转载 2020-08-06 11:42:53 · 127 阅读 · 0 评论 -
C++:内存管理——从平地到万丈高楼
目录第一讲 primitives第二讲 malloc/free第三讲 std::allocator第四讲 other allocators第五讲 loki::allocator第一讲 primitives第二讲 malloc/free第三讲 std::allocator第四讲 other allocators第五讲 loki::allocator原创 2020-08-01 22:21:36 · 952 阅读 · 0 评论 -
C++:大小写转换
文章目录1、transform2、tolower(char c)和toupper(char c)3、strupr(char* a)和strlwr(char* d)4、位运算技巧1、transform如果使用string类,可以使用#include <algorithm>里的如下方法进行大小写转换;(leetcode不支持这个函数)transform(str.begin(),str...转载 2020-04-13 12:56:18 · 1809 阅读 · 0 评论 -
C++:虚函数、构造函数、析构函数
https://blog.csdn.net/yc461515457/article/details/52658589?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-taskhttps://blog.csdn.net/gaojing303504/artic...转载 2020-04-09 17:21:02 · 463 阅读 · 0 评论 -
C++:typedef结构体分别加指针、数组、函数的使用
https://www.cnblogs.com/lemaden/p/10169118.htmlhttps://www.cnblogs.com/lemaden/p/10169118.html转载 2020-04-09 14:09:29 · 2424 阅读 · 2 评论 -
C++:pair
https://blog.csdn.net/sevenjoin/article/details/81937695转载 2020-04-08 14:04:59 · 134 阅读 · 0 评论 -
C++:map和 unordered_map
https://blog.csdn.net/BillCYJ/article/details/78985895?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task转载 2020-04-08 12:40:03 · 4337 阅读 · 1 评论 -
C++:set、multiset、unordered_set、unordered_multiset
https://blog.csdn.net/CerberuX/article/details/51774121https://blog.csdn.net/qq_41855420/article/details/89765258转载 2020-04-05 14:36:39 · 639 阅读 · 0 评论 -
C++:strcat、strcpy、strcmp、strupr、strlwr
https://blog.csdn.net/Paulliam/article/details/80027413转载 2020-04-05 00:22:36 · 426 阅读 · 0 评论 -
C++:sort与qsort
这里写自定义目录标题一、sort(1)升序(缺省)(2)降序(3)升降序灵活组合(4)STL容器的排序(vector,deque,string)二、qsort(1)对int类型数组排序(2)对char类型数组排序(同int类型)(3)对double类型数组排序(特别要注意)(4)对结构体一级排序(5)对结构体二级排序(6)对字符串进行排序(7)对结构体中的字符串排序三、sort和qsort对比...转载 2020-04-04 15:10:58 · 752 阅读 · 0 评论 -
C++:保留小数点后几位
文章目录一、话不多说,直接上代码二、setprecision(n)三、fixed一、话不多说,直接上代码 #include <iomanip> //不要忘了头文件 #define PI acos(-1) cout << PI << endl; //3.14159 double num = 0.202044;//第一种写法:设置...转载 2020-04-04 11:36:47 · 5279 阅读 · 1 评论 -
C++:刷题输入
文章目录Ⅰ、规范注意:输入是多组输入,不是一组Ⅱ、相关输入语法一、cin>>二、cin.getline()三、getline()四、注意的问题Ⅰ、规范注意:输入是多组输入,不是一组(1)输入预先不输入数据的组数while(cin>>a>>b){ cout<<a+b<<endl;}(2)预先知道数据组数cin>...转载 2020-03-31 15:55:04 · 641 阅读 · 0 评论 -
C++:string
https://blog.csdn.net/pengnanzheng/article/details/80549445?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-taskhttps://blog.csdn.net/qq_30534935/articl...转载 2020-03-30 17:34:36 · 216 阅读 · 0 评论 -
C++:vector
https://blog.csdn.net/qinyuehong/article/details/92837359https://blog.csdn.net/sinat_41852207/article/details/86668954转载 2020-03-29 23:48:04 · 265 阅读 · 0 评论 -
C++:dec、hex和oct(十进制、十六进制、八进制)
详解:dec是十进制 如cout<<dec<<b 就会把b转换成10进制再输出hex是16进制 如cout<<hex<<b 就会把b转换成16进制再输出oct是8进制 如cout<<oct<<b 就会把b转换成8进制再输出例子1:#include<iostream>using namespace...转载 2020-03-29 22:28:44 · 13079 阅读 · 1 评论