![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ STL
JDSH0224
这个作者很懒,什么都没留下…
展开
-
C++深拷贝和浅拷贝构造函数
深拷贝:内存拷贝,每块内存有不同的指针浅拷贝:指针的拷贝,拷贝之后指向同一块内存typedef struct { int index; //对应APP接口协议中的索引号 int iRegThrdCnt; //注册的线程个数}TMsgGather;class CMsgGather{public: CMsgGather(); ~CMsgGather(); CMsgGather(const CMsgGather &msgGather); //深拷贝构造priv.原创 2021-01-12 09:23:50 · 85 阅读 · 0 评论 -
map+vector+struct+string组合
1. map+vector+structusing namespace std;//单笔记录typedef struct { int idx; //索引 string str; //记录}TStepRec;//记录“容器<多笔记录>”typedef vector<TStepRec> VECT2TSTEPREC;//记录“键值+容器<多笔记录...原创 2019-11-20 09:21:24 · 172 阅读 · 0 评论 -
容器vector属性size和capacity的区别
1. 属性size是容器里真实个数;2. 属性capacity是realloc预分配的值;详见:https://blog.csdn.net/u013575812/article/details/51171135原创 2019-11-08 09:40:54 · 242 阅读 · 0 评论 -
结构体中存在string成员,使用memset后,在赋值出现段错误
详见:https://blog.csdn.net/s3olo/article/details/11715143原创 2019-11-06 15:13:06 · 1463 阅读 · 0 评论 -
char 字符装string类、string类转字符
const char c = 'a';//1.使用 string 的构造函数string s(1,c);//2.声明string 后将char push_backstring s1;s1.push_back(c);//3.使用stringstream//4.输出字符s1.c_str();stringstream ss;ss << c;string str2 =...原创 2019-10-31 16:18:31 · 112 阅读 · 0 评论 -
容器vercor向量结构体迭代
#include<stdio.h>#include<algorithm>#include<vector>#include<iostream>using namespace std; typedef struct rect{ int id; int length; int width; //对于向量元素是...原创 2019-10-31 16:13:27 · 258 阅读 · 0 评论