std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>:: size
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::flat_map
|
size_type size
(
)
const
noexcept
;
|
(C++23以降) | |
コンテナアダプタ内の要素数を返します。以下と同等です:
return
c
.
keys
.
size
(
)
.
目次 |
パラメータ
(なし)
戻り値
コンテナアダプタ内の要素数。
計算量
定数。
例
このコードを実行
#include <cassert> #include <flat_map> int main() { std::flat_map<int, char> nums{{1, 'a'}, {1, 'b'}, {2, 'c'}, {2, 'd'}}; assert(nums.size() == 2); }
関連項目
|
コンテナアダプタが空かどうかをチェックする
(public member function) |
|
|
(C++17)
(C++20)
|
コンテナまたは配列のサイズを返す
(function template) |
|
可能な最大要素数を返す
(public member function) |