std::map::size
Aus cppreference.com
[] |
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. |
<metanoindex/>
<tbody> </tbody> size_type size() const; |
||
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Parameter
(None)
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.
Rckgabewert
die Anzahl der Elemente in dem Behlter
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.
Ausnahmen
Komplexitt
Constant
Beispiel
The following code uses size to display the number of elements in a std::map<int>:
#include <map>
#include <iostream>
int main()
{
std::map<int, char> nums {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}};
std::cout << "nums contains " << nums.size() << " elements.\n";
}
Output:
nums contains 4 elements.
Siehe auch
prft, ob der Container leer ist 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. (ffentliche Elementfunktion) | |
gibt die maximal mgliche Anzahl von Elementen 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. (ffentliche Elementfunktion) | |