Namespaces
Variants

std::multiset<Key,Compare,Allocator>:: size

From cppreference.net

size_type size ( ) const ;
(自 C++11 起为 noexcept)
(自 C++26 起为 constexpr)

返回容器中的元素数量。

目录

返回值

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

复杂度

常量。

示例

#include <cassert>
#include <set>
int main()
{
    std::multiset<int> nums{4, 2, 4, 2};
    assert(nums.size() == 4);
}

参见

检查容器是否为空
(公开成员函数)
返回可能容纳的最大元素数
(公开成员函数)
(C++17) (C++20)
返回容器或数组的大小
(函数模板)