Namespaces
Variants

std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>:: size

From cppreference.net

size_type size ( ) const noexcept ;
(seit C++23)

Gibt die Anzahl der Elemente im Container-Adapter zurück. Entspricht: return c . keys . size ( ) .

Inhaltsverzeichnis

Parameter

(keine)

Rückgabewert

Die Anzahl der Elemente im Container-Adapter.

Komplexität

Konstante.

Beispiel

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

Siehe auch

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