commit | dfe2034d355f41c4a2f28c3b65ca4a751b1818d3 | [log] [tgz] |
---|---|---|
author | Daniel Cheng <dcheng@chromium.org> | Thu Aug 08 03:33:52 2024 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Aug 08 03:33:52 2024 |
tree | 34ead6df5dfa7e000ab5ff8474fbf53b22b611c4 | |
parent | 6213088c4f0f1a0cd38ab6360276d085eb66fdaf [diff] |
Implement `span::to_fixed_extent<N>(...)` to replace `make_span<N>(...)` `span::to_fixed_extent<N>()` is a helper that converts a dynamic-extent span to a fixed-extent span at runtime. In theory, this isn't needed since there are already several ways to do this conversion: - `first<N>(...)`, `last<N>(...)`, and `subspan<0, N>(...)` all extract a fixed-extent span from a dynamic-extent span. However, none of these express the intent "this span is exactly size N" without the caller writing additional checks. - `make_span<N>(...)` makes a runtime-checked fixed-extent span from a container with dynamic length. However: - In general, the `make_span<...>(...)` family of functions will migrate to CTAD in the future. - As a free function, it can be used with any type of spannable object even when it's not necessary. - Using an explicit `span<T, N>` construction. However, this requires writing `T` again, which can sometimes be clunky. The introduction of this helper allows the removal of `as_byte_span<N>()` and `as_writable_byte_span<N>()`, and will facilitate the future removal of `make_span<N>()`. Finally, remove redundant constraints from `as_byte_span()` and `as_writable_byte_span()` as part of cleaning up the overloads. Bug: 341907909, 355603418 Change-Id: I6191eb9191371e32db3a618c77888d773a12fa8c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5763092 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#1338855}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.