size_t(-1) / sizeof(_Tp)到底是何意义?
来源:互联网 发布:品茗软件电话 编辑:程序博客网 时间:2024/05/15 09:11
Ø size_t(-1)/sizeof(_Tp)到底是什么意义? 以32位机来说,它代表了实现/平台允许你放入容器的最大元素数目,对于std::vector<T>最大容量为2^32 / sizeof(T) 个元素。换句话来说, 也就是我能完全使用4GiB虚拟内存地址空间(实际不可能)而填充的最大元素数目。 Ø 为什么size_t(-1)为2^32? size_t通常在32位机上定义为32位,而在64位机上定义为64位的无符号整型。通过强制类型转换,size_t(-1)恰能代表其能表示的最大值,即2^32 (2^64). 英文资料:Type size_t 来源:维基百科 http://en.wikipedia.org/wiki/Stddef.h The type size_t represents the appropriate type for representing the size of objects of memory areas, and for use in dereferencing the elements of an array. It has an implementation-dependent size; usually but not necessarily, it has a 32-bit representation on 32-bit systems and a 64-bit representation on 64-bit systems. It is unsigned.
- size_t(-1) / sizeof(_Tp)到底是何意义?
- size_t、sizeof、strlen
- size_t、sizeof、strlen
- size_t 到底多大
- sizeof到底是关键字还是运算符呢?
- sizeof(void*)的大小到底由何决定?(个人理解)
- size_t(-1)
- size_t类型和sizeof()运算符
- sizeof运算符和size_t类型比较
- sizeof运算符和size_t类型
- sizeof运算符和size_t类型
- 继承到底有计么意义?
- sizeof(size_t)的疑惑||size_t sizeof long unsigned int printf max value
- “汉语编程”有何意义?
- 胡适:人生有何意义
- sizeof到底该怎么算
- size_t
- size_t
- 彼得定律与员工职业生涯规划(该提拔谁,职业规划,知人善用)
- mfc向导生成的 默认窗口大小和位置是如何设置的
- 我常去的编程技术网站
- 首次写博客
- uCOS-II for lpc2200 移植心得
- size_t(-1) / sizeof(_Tp)到底是何意义?
- strcpy 的实现
- Android 桌面组件【widget】初探
- ruby2
- Traits技术初探
- Linux下SPI驱动分析(4)
- 由无线条码枪到WebOS PDA的构想
- 火烧眉毛 急救篇
- sphinx总结