Fix + test copying of fixed-sized ArrayView rvalues
Previously, only lvalues were tested, and only lvalues worked. Bug: webrtc:11389 Change-Id: I524e9d63e0840c3ba274dbe2062d78f72d79019d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169347 Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30644}
This commit is contained in:
@ -213,6 +213,14 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
|
||||
: ArrayView(u.data(), u.size()) {
|
||||
static_assert(U::size() == Size, "Sizes must match exactly");
|
||||
}
|
||||
template <
|
||||
typename U,
|
||||
typename std::enable_if<Size != impl::kArrayViewVarSize &&
|
||||
HasDataAndSize<U, T>::value>::type* = nullptr>
|
||||
ArrayView(const U& u) // NOLINT(runtime/explicit)
|
||||
: ArrayView(u.data(), u.size()) {
|
||||
static_assert(U::size() == Size, "Sizes must match exactly");
|
||||
}
|
||||
|
||||
// (Only if size is variable.) Construct an ArrayView from any type U that
|
||||
// has a size() method whose return value converts implicitly to size_t, and
|
||||
|
||||
Reference in New Issue
Block a user