std::flat_set<Key,Compare,KeyContainer>::size
来自 cppreference.cn
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) | |
(C++17)(C++20) |
返回容器或数组的大小 (function template) |
返回可能的最大元素数量 (public member function) |