社区
工具平台和程序库
帖子详情
C++标准库中size_type max_size() const { return size_type(-1)/*啥意思*/; }
alison
2003-07-12 02:20:27
C++标准库中size_type max_size() const { return size_type(-1)/*啥意思*/; }
...全文
138
8
打赏
收藏
C++标准库中size_type max_size() const { return size_type(-1)/*啥意思*/; }
C++标准库中size_type max_size() const { return size_type(-1)/*啥意思*/; }
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
sirouni2003
2003-07-15
打赏
举报
回复
up
cxjddd
2003-07-15
打赏
举报
回复
-1正好是size_type的最大值
Iaoapbicfis
2003-07-15
打赏
举报
回复
UP!看书去!
mahatma_cn
2003-07-14
打赏
举报
回复
看字面意思也能理解吧!
返回容器的长度,请参考msdn
zh7780
2003-07-14
打赏
举报
回复
up
coffeebike
2003-07-14
打赏
举报
回复
-1就是计算机中,最大的整数啊,这个你知道吗!?
Cybergate
2003-07-14
打赏
举报
回复
size_type是无符号数,
一般定义:typedef unsigned long int size_type
将-1转换成无符号数就是最大整数。
njSeeWhy
2003-07-12
打赏
举报
回复
这是哪个库中定义的函数?
size
_t(-1)
今天遇到标准答案
中
的
max
_
size
中
的最大可以allocate的数量
size
_
type
max
_
size
()
const
{
return
std::
size
_t(-1) /
size
of(T); } 现在终于搞懂 因为
size
_t是unsigned的 所以将-1强制转换为unsigned会得到这个类型的最大数 也就是说..
C/
C++
中
的
size
_t - std::
size
_t
C/
C++
中
的
size
_t - std::
size
_t
C++
基础---string类的capacity/
max
_
size
/
size
/length/empty/reserve/re
size
1. string
中
capacity/
max
_
size
/
size
/length/empty/reserve/re
size
1.1 std::string::capacity 原型:
size
_t capacity()
const
; 说明: 返回string分配的存储容量。 1.2 std::string::
max
_
size
原型:
size
_t
max
_
size
()
const
; 说明: 返回string对象
中
无符号整数(string::
size
_
type
,
size
_t,unsigned,long unsigned)
string::
size
_
type
size
_t unsigned long unsigned
STL vector
中
的
max
_
size
方法(29)
public member function std::vector::
max
_
size
C++
98
C++
11
size
_
type
max
_
size
()
const
noexcept;
Return
max
imum
size
Return
s the
max
imum number of elements that the vector
工具平台和程序库
24,853
社区成员
27,330
社区内容
发帖
与我相关
我的任务
工具平台和程序库
C/C++ 工具平台和程序库
复制链接
扫一扫
分享
社区描述
C/C++ 工具平台和程序库
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章