Skip to content

Commit

Permalink
Make non-constexpr span helper methods inline.
Browse files Browse the repository at this point in the history
Change-Id: I3188caeaf57c25cfb9f35913f42b4ebba353b42c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5018554
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1223137}
  • Loading branch information
danakj authored and Chromium LUCI CQ committed Nov 10, 2023
1 parent 5e2c8e4 commit 4edaca4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/containers/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,16 @@ span(Container&&) -> span<T, X>;

// [span.objectrep], views of object representation
template <typename T, size_t X>
span<const uint8_t, (X == dynamic_extent ? dynamic_extent : sizeof(T) * X)>
inline span<const uint8_t,
(X == dynamic_extent ? dynamic_extent : sizeof(T) * X)>
as_bytes(span<T, X> s) noexcept {
return {reinterpret_cast<const uint8_t*>(s.data()), s.size_bytes()};
}

template <typename T,
size_t X,
typename = std::enable_if_t<!std::is_const_v<T>>>
span<uint8_t, (X == dynamic_extent ? dynamic_extent : sizeof(T) * X)>
inline span<uint8_t, (X == dynamic_extent ? dynamic_extent : sizeof(T) * X)>
as_writable_bytes(span<T, X> s) noexcept {
return {reinterpret_cast<uint8_t*>(s.data()), s.size_bytes()};
}
Expand Down

0 comments on commit 4edaca4

Please sign in to comment.