std::multiset<Key,Compare,Allocator>::size
來自 cppreference.com
size_type size() const; |
(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 成員函式) | |
返回元素的最大可能數量 (public 成員函式) | |
(C++17 起)(C++20 起) |
返回容器或陣列的大小 (函式模板) |