命名空间
变体
操作

std::flat_set<Key,Compare,KeyContainer>::size

来自 cppreference.cn
< cpp‎ | container‎ | flat set
 
 
 
 
size_type size() const noexcept;
(since C++23)

返回容器适配器中元素的数量。等效于: return c.size().

内容

[edit] 参数

(无)

[edit] 返回值

容器适配器中元素的数量。

[edit] 复杂度

常数。

[edit] 示例

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

[edit] 参见

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