最終更新日時(UTC): 2024年06月11日 13時45分38秒 Akira Takahashi が更新
履歴 編集
constexpr size_type size_bytes() const noexcept;
参照している範囲のバイト数を取得する。
以下と等価:
return size() * sizeof(element_type);
投げない
定数時間
#include <cassert> #include <span> #include <vector> int main() { std::vector<int> v = {1, 2, 3, 4, 5}; assert(std::span{v}.size_bytes() == 5 * sizeof(int)); assert(std::span{v}.first(3).size_bytes() == 3 * sizeof(int)); }
span
size_type
index_type