std::hive<T,Allocator>::size
ja.cppreference.net から
size_type size() const noexcept;
|
(C++26 から) | |
コンテナ内の要素の数を返します。すなわち、std::distance(begin(), end())。
戻り値
コンテナ内の要素の数。
計算量
定数時間。
例
このコードを実行
#include <cassert>
#include <hive>
int main()
{
std::hive<int> bees;
assert(bees.size() == 0);
bees = {1, 2, 3, 4};
assert(bees.size() == 4);
}
関連項目
| コンテナが空かどうかを調べる (パブリックメンバ関数) | |
| 可能な最大要素数を返す (パブリックメンバ関数) | |
(C++17)(C++20) |
コンテナまたは配列のサイズを返す (関数テンプレート) |