会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
appearAndLeave
博客园
首页
新随笔
管理
2021年9月21日
多重继承下,注意父类指针new子类对象的相关问题
摘要: #include<iostream> using namespace std; class base1 { public: int base1_1; int base1_2; base1() { cout << "base1的地址\t" << this << endl; } }; class bas
阅读全文
posted @ 2021-09-21 15:48 appearAndLeave
阅读(152)
评论(0)
推荐(0)
2021年8月19日
二叉树非递归遍历
摘要: #include<iostream> #include<stack> #include<vector> struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) { val = x; left = null
阅读全文
posted @ 2021-08-19 18:54 appearAndLeave
阅读(30)
评论(0)
推荐(0)
浅谈各种排序算法
摘要: 插入排序 #include<iostream> #include<vector> using namespace std; void insertSort(vector<int> &arr) { //插入sort int key = 0; int j = 0; for(int i = 1; i <
阅读全文
posted @ 2021-08-19 18:53 appearAndLeave
阅读(43)
评论(0)
推荐(0)
2021年7月31日
STL源码解析 Vector
摘要: vector 定义 单向开口的连续线性空间 动态数组 迭代器: 普通指针 数据结构 vector的数据结构 是 线性连续空间 三个迭代器 start finish end_of_storage 构造和内存管理 构造时指定空间大小 构造时指定空间大小,则空间的finish和end_of_storage
阅读全文
posted @ 2021-07-31 23:34 appearAndLeave
阅读(61)
评论(0)
推荐(0)
2021年7月1日
IP地址转换函数(IP地址和网络字节序 相互转换)
摘要: 环境: linux gcc 三个函数 (适合IPV4) #include<arpa/inet.h> in_addr_t inet_addr(const char * strptr); //将 IP 转换成 网络字节序 int inet_aton(const char * strptr,struct
阅读全文
posted @ 2021-07-01 21:44 appearAndLeave
阅读(1312)
评论(0)
推荐(0)
2021年6月2日
快速排序
摘要: #include <iostream> #include<vector> using namespace std; void quickSort(vector<int > & vec ,int start,int end) { if (start < end) { int left = start,
阅读全文
posted @ 2021-06-02 00:01 appearAndLeave
阅读(36)
评论(0)
推荐(0)
2021年5月24日
连接池 和 监听队列
摘要: 采用Nginx的源码思想来写 监听套接字队列 监听端口数有多少个,那么监听队列就多长 结构体ngx_listening_s 每一个都包含 端口号 sockfd 指向连接对象的指针 vector<ngx_listening_s> 对象数组,刚开始在运行前就被初始化,配置好 连接池 可以看成 对象数组
阅读全文
posted @ 2021-05-24 14:21 appearAndLeave
阅读(189)
评论(0)
推荐(0)
2021年5月19日
5.1.3 简单的 客户端 和服务端 程序实现代码
摘要: 服务端 调用socket函数返回一个文件描述符sockfd 专用socket地址 UNIX 本地协议簇 struct sockaddr_un TCP/IP协议簇 struct sockaddr_in //IPV4 struct sockaddr_in6 //IPV6 struct sockaddr_
阅读全文
posted @ 2021-05-19 15:27 appearAndLeave
阅读(113)
评论(0)
推荐(0)
2021年5月13日
第9章 指针
摘要: 指针数组和数组指针 因为 [] 比 * 优先级 高 指针数组 :一个数组里存放的是指针 int * p[4]; 数组指针 : int (* p)[4];//指向一维数组的指针变量 指向指针的指针 int ** p; 以下代码p是存放 的是 str 的地址 str是指向字符串的字符指针。 *p 代表着
阅读全文
posted @ 2021-05-13 00:13 appearAndLeave
阅读(63)
评论(0)
推荐(0)
2021年5月12日
输出当前时间-linux-C
摘要: 环境:linuc 编译器:GCC 输出当前时间 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> //uintptr_t #include <stdarg.h> //va_start....
阅读全文
posted @ 2021-05-12 14:34 appearAndLeave
阅读(170)
评论(0)
推荐(0)
公告