当前位置:网站首页>U++ learning notes - relaxation
U++ learning notes - relaxation
2022-07-02 22:34:00 【It's a bald rabbit】
Because the default constructed array does not allocate memory , So the relaxation is initially zero .GetSlack You can use this function to find out how much slack there is in the array . Before the container is reallocated , The maximum number of elements that the array can hold can be through Max Function to obtain .GetSlack amount to and Between Max Bad Num:
TArray<int32> SlackArray;
// SlackArray.GetSlack() == 0
// SlackArray.Num() == 0
// SlackArray.Max() == 0
SlackArray.Add(1);
// SlackArray.GetSlack() == 3
// SlackArray.Num() == 1
// SlackArray.Max() == 4
SlackArray.Add(2);
SlackArray.Add(3);
SlackArray.Add(4);
SlackArray.Add(5);
// SlackArray.GetSlack() == 17
// SlackArray.Num() == 5
// SlackArray.Max() == 22The above is TArray Automatic expansion of
There is one Reset And Empty Similar functions , Except if the current assignment has provided the requested slack, It will not free memory . however , If requested slack more , It will allocate more memory :
SlackArray.Reset(0);
// SlackArray.GetSlack() == 3
// SlackArray.Num() == 0
// SlackArray.Max() == 3
SlackArray.Reset(10);
// SlackArray.GetSlack() == 10
// SlackArray.Num() == 0
// SlackArray.Max() == 10 Last , You can use this function to delete all slack, The Shrink Function will adjust the allocated size to the minimum size required to accommodate the current element .Shrink It has no effect on the elements in the array :
SlackArray.Add(5);
SlackArray.Add(10);
SlackArray.Add(15);
SlackArray.Add(20);
// SlackArray.GetSlack() == 6
// SlackArray.Num() == 4
// SlackArray.Max() == 10
SlackArray.Shrink();
// SlackArray.GetSlack() == 0
// SlackArray.Num() == 4
// SlackArray.Max() == 4边栏推荐
- Attack and defense world PWN question: Echo
- kubernetes资源对象介绍及常用命令(四)
- Regular expression (2)
- "New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
- Phpcms realizes the direct Alipay payment function of orders
- Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
- Bridge emqx cloud data to AWS IOT through the public network
- 《Just because》阅读感受
- Utilisation de simpletk - 4. Question étrange
- Ransack combined condition search implementation
猜你喜欢

Source code analysis - lightweight asynchronous crawler framework Ruia

Socket套接字C/S端流程
![[ODX studio edit PDX] -0.1- how to quickly view the differences in supported diagnostic information between variant variants (service, sub function...)](/img/2b/f31b81cedf37ca187bcaa20dfe0b83.png)
[ODX studio edit PDX] -0.1- how to quickly view the differences in supported diagnostic information between variant variants (service, sub function...)

Sql service intercepts string

基于ASP.net的手机销售管理系统(二手手机销售管理系统)+ASP.NET+C#语言+VS2010+数据库可以用于课设、毕设学习

Perceptron model and Application
![[001] [arm-cortex-m3/4] internal register](/img/49/a0eceac1a67267216dd9b2566033a1.jpg)
[001] [arm-cortex-m3/4] internal register

sql service 截取字符串

The source code of the daily book analyzes the design idea of Flink and solves the problems in Flink

SimpleITK使用——4. 奇怪的问题
随机推荐
Market Research - current market situation and future development trend of genome editing mutation detection kit
[shutter] shutter application life cycle (foreground state resumed | background state paused | inactive | component separation state detached)
ServiceMesh主要解决的三大痛點
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!
《乔布斯传》英文原著重点词汇笔记(九)【 chapter seven】
Une semaine de vie
Sql service intercepts string
[C question set] of V
Share how to make professional hand drawn electronic maps
影视随摘
APP页面分享口令Rails实现
Simpleitk use - 4 Strange question
App page sharing password rails implementation
ArrayList analysis 2: pits in ITR, listiterator, and sublist
Market Research - current market situation and future development trend of high tibial osteotomy plate
Necessary browser plug-ins for network security engineers
【C 题集】of Ⅴ
数学建模——图与网络模型及方法(一)
phpcms实现订单直接支付宝支付功能
Official announcement! The golden decade of new programmers and developers was officially released