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"; }
Вывод:
nums contains 4 elements.
[править] См. также
| проверяет отсутствие элементов в контейнере (public функция-член) | |
| возвращает максимально допустимое количество элементов (public функция-член) | |