Delete deprecated reinterpret_array_view Bug: webrtc:439801349 Change-Id: I61cdbef2b6f5e30b561766356258a463087db9de Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/461280 Auto-Submit: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47302}
diff --git a/api/array_view.h b/api/array_view.h index c670314..8414ac0 100644 --- a/api/array_view.h +++ b/api/array_view.h
@@ -13,7 +13,6 @@ #include <cstddef> #include <span> -#include <type_traits> namespace webrtc { @@ -26,24 +25,6 @@ return ArrayView<T>(data, size); } -// Only for primitive types that have the same size and aligment. -// Allow reinterpret cast of the array view to another primitive type of the -// same size. -// Template arguments order is (U, T, Size) to allow deduction of the template -// arguments in client calls: reinterpret_array_view<target_type>(array_view). -template <typename U, typename T, size_t Size> -[[deprecated]] ArrayView<U, Size> reinterpret_array_view( - ArrayView<T, Size> view) { - static_assert(sizeof(U) == sizeof(T) && alignof(U) == alignof(T), - "ArrayView reinterpret_cast is only supported for casting " - "between views that represent the same chunk of memory."); - static_assert( - std::is_fundamental<T>::value && std::is_fundamental<U>::value, - "ArrayView reinterpret_cast is only supported for casting between " - "fundamental types."); - return ArrayView<U, Size>(reinterpret_cast<U*>(view.data()), view.size()); -} - } // namespace webrtc
diff --git a/api/array_view_unittest.cc b/api/array_view_unittest.cc index bd7e491..ae0f830 100644 --- a/api/array_view_unittest.cc +++ b/api/array_view_unittest.cc
@@ -611,27 +611,4 @@ EXPECT_EQ((av.last<2>()).extent, 2u); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -TEST(ArrayViewTest, TestReinterpretCastFixedSize) { - uint8_t bytes[] = {1, 2, 3}; - ArrayView<uint8_t, 3> uint8_av(bytes); - ArrayView<int8_t, 3> int8_av = reinterpret_array_view<int8_t>(uint8_av); - EXPECT_EQ(int8_av.size(), uint8_av.size()); - EXPECT_EQ(int8_av[0], 1); - EXPECT_EQ(int8_av[1], 2); - EXPECT_EQ(int8_av[2], 3); -} - -TEST(ArrayViewTest, TestReinterpretCastVariableSize) { - std::vector<int8_t> v = {1, 2, 3}; - ArrayView<int8_t> int8_av(v); - ArrayView<uint8_t> uint8_av = reinterpret_array_view<uint8_t>(int8_av); - EXPECT_EQ(int8_av.size(), uint8_av.size()); - EXPECT_EQ(uint8_av[0], 1); - EXPECT_EQ(uint8_av[1], 2); - EXPECT_EQ(uint8_av[2], 3); -} -#pragma clang diagnostic pop - } // namespace webrtc