Namespaces
Variants

std::multimap<Key,T,Compare,Allocator>:: size

From cppreference.net

size_type size ( ) const ;
(noexcept seit C++11)
(constexpr seit C++26)

Gibt die Anzahl der Elemente im Container zurück.

Inhaltsverzeichnis

Rückgabewert

std:: distance ( begin ( ) , end ( ) )

Komplexität

Konstante.

Beispiel

#include <cassert>
#include <map>
int main()
{
    std::multimap<int, char> nums{{1, 'a'}, {1, 'b'}, {2, 'c'}, {2, 'd'}};
    assert(nums.size() == 4); 
}

Siehe auch

prüft, ob der Container leer ist
(öffentliche Elementfunktion)
gibt die maximal mögliche Anzahl von Elementen zurück
(öffentliche Elementfunktion)
(C++17) (C++20)
gibt die Größe eines Containers oder Arrays zurück
(Funktionstemplate)