std::as_bytes, std::as_writable_bytes_C++中文网
| template< class T, std::size_t N> |
(1) | |
| template< class T, std::size_t N> |
(2) | |
获得对 span s 的元素的对象表示的视图。
若 N 为 std::dynamic_extent ,则返回的 span S 的长度亦为 std::dynamic_extent ;否则它是 sizeof(T) * N 。
as_writable_bytes 仅若 std::is_const_v<T> 为 false 才参与重载决议。
返回值
1) 以 {reinterpret_cast<const std::byte*>(s.data()), s.size_bytes()} 构造的 span 。
2) 以 {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()} 构造的 span 。