命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | 容器‎ | multiset
 
 
 
 
size_type size() const;
(noexcept since C++11)

返回容器中元素的数量,即 std::distance(begin(), end())

目录

[编辑] 返回值

容器中元素的数量。

[编辑] 复杂度

常数时间复杂度。

[编辑] 示例

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

[编辑] 参见

检查容器是否为空
(public member function) [编辑]
返回最大可能元素数量
(public member function) [编辑]
(C++17)(C++20)
返回容器或数组的大小
(function template) [编辑]