std::unordered_multimap::size
来自cppreference.com
< cpp | container | unordered multimap
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| size_type size() const; |
(C++11 起) | |
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
目錄 |
[编辑] 參數
(無)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 返回值
在容器中的元素的數量
Original:
the number of elements in the container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 例外
[编辑] 複雜性
Constant
[编辑] 為例
The following code uses size to display the number of elements in a std::unordered_multimap<int>:
#include <unordered_multimap> #include <iostream> int main() { std::unordered_multimap<int, char> nums {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}}; std::cout << "nums contains " << nums.size() << " elements.\n"; }
Output:
nums contains 4 elements.
[编辑] 另請參閱
| 檢查是否容器是空的 Original: checks whether the container is empty The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成員函數) | |
| 返回可能的最大數量的元素 Original: returns the maximum possible number of elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成員函數) | |