std::span<T,Extent>::size_bytes
From cppreference.com
| constexpr size_type size_bytes() const noexcept; |
(C++20以降) | |
シーケンスのバイト単位のサイズを返します。
目次 |
[編集] パラメータ
(なし)
[編集] 戻り値
シーケンスのバイト単位のサイズ、すなわち size() * sizeof(element_type)。
[編集] 例
このコードを実行
#include <cstdint> #include <span> int main() { constexpr static std::int32_t a[]{1, 2, 3, 4, 5}; constexpr static std::span s{a}; static_assert ( sizeof(int32_t) == 4 && std::size(a) == 5 && sizeof a == 20 && s.size() == 5 && s.size_bytes() == 20 ); }
[編集] 関連項目
| (C++20) |
シーケンス内の要素数を返します (public member function) |