public member function
<vector>
std::vector::max_size
size_type max_size() const noexcept;
Return maximum size
Returns the maximum number of elements that thevectorcan hold.
返回vector所能储存的最大的元素数目。
This is the maximum potentialsizethe container can reach due to known system or library implementation limitations,
but the container is by no means guaranteed to be able to reach that size: it can still fail to allocate storage at any point before that size is reached.
容器所能容纳的最大元素数目,这是系统或者库所实施的限制。但是容器不一定保证能达到该大小,有可能在还未达到该大小的时候,就已经无法继续分配任何的空间了。
Parameters
none
Return Value
The maximum number of elements avectorcontainer can hold as content.
容器所能容纳的最大数目的元素个数。
Member typesize_typeis an unsigned integral type.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// comparing size, capacity and max_size
#include <iostream>
#include <vector>
int main ()
{
std::vector<int> myvector;
// set some content in the vector:
for (int i=0; i<100; i++) myvector.push_back(i);
std::cout << "size: " << myvector.size() << "\n";
std::cout << "capacity: " << myvector.capacity() << "\n";
std::cout << "max_size: " << myvector.max_size() << "\n";
return 0;
}
|
|
A possible output for this program could be:
size: 100
capacity: 128
max_size: 1073741823
|
运行截图:
Complexity
Constant.
Iterator validity
No changes.
Data races
The container is accessed.
容器将被访问。
No contained elements are accessed: concurrently accessing or modifying them is safe.
容器内的元素不会被访问,同时访问以及修改他们也是安全的。
Exception safety
No-throw guarantee:this member function never throws exceptions.
该方法不会抛出异常。
//翻译的不好的地方请多多指导,可以在下面留言或者点击左上方邮件地址给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。
转载请注明出处:http://blog.csdn.net/qq844352155
2014-8-18
于GDUT
分享到:
相关推荐
c++ STL source code, hash and vector etc
用于三维光学形貌扫描完成后,生成的stl文件的读取,并形成俯视投影云图
标准模板库中map、vector、以及sort等的用法讲解
C++读取STL文件,输出所有三角形的顶点坐标
stlshow_stl分层_STL分层_stlmatlab_STL切片_stl分层.zip
C++中标准模板库中vector容器的基本概念与基本操作
stlshow_stl分层_STL分层_stlmatlab_STL切片_stl分层_源码.rar.rar
STL课件_C++_课件stl_c++课件_源码.zip
09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板09_07_IO_STL标准模板...
STL vector 知识详解 STL vector 知识详解 STL vector 知识详解 STL vector 知识详解 STL vector 知识详解
STL学习教程,
STL 最新源代码
C++ STL 参考手册Cpp_STL_ReferenceManual ,对学习STL 有帮助
Depue_Vector_Compare.rar
vc显示stl,读取顶点坐标,并显示在独立窗口中
SGI STL是由SGI公司开发的STL库.这份STL可以用在VC上.
在MATLAB中完成STL数据的渲染,用PATCH函数完成加颜色和亮度等功能
最新的STL源码,最新的STL源码,最新的STL源码
stl的入门ppt 很好用哦,分为导入 STL的概念与组成 Iterator(迭代器) Container(容器) Algorithm(算法) Adaptors(配接器)
读取、显示STL格式的3D文件,可对二进制的STL文件进行读取、显示。显示模式可以选择有网格、无网格等。