验证 vector = 是深拷贝还是浅拷贝
2024-10-06 09:37:18
#include <vector>
using namespace std;
int main()
{
int w=1920;
int h = 1080;
vector<int> dataA( w*h ,0Xff); vector<int> dataB = dataA; int * ptr0 = &dataA[0];
int * ptr1 = &dataB[0]; printf( "%u\n",ptr0 );
printf("%u\n", ptr1); return 0;
}
output:
959246464
967577728
两者数据指针地址不同 , 所以是深拷贝!!!
最新文章
- Redis连接
- thinkphp自定义标签库
- js隐式转换
- PHP团队 编码规范 &; 代码样式风格规范
- Linux学习笔记(7)Linux常用命令之压缩解压命令
- SQLServer数据库的一些全局变量
- iOS开发——高级技术&;生成二维码
- Python 学习入门(22)—— 线程同步
- 浅谈href=#与href=javascript:void(0)的区别
- shell编程值之shell流程控制(7)
- selenium模块
- S-CMS企业建站v3几处SQL注入
- Troubleshooting tips for using Java on Windows 8
- 5.28 js基础 简介
- HTTP 各状态码大全
- 7za命令报错Error: xxx is not supported archive
- SQLServer限制IP,限制用户,限制SSMS登录
- 天气提醒邮件服务器(python + scrapy + yagmail)
- java中的Iterator和Iterable 区别
- 【ASP.NET 框架系列】您所经历的,但未必研究的那些技术