| 647 | and the total byte size doesn't change. |
| 648 | */ |
| 649 | template<class U, class T> ArrayView<U> arrayCast(ArrayView<T> view) { |
| 650 | static_assert(std::is_standard_layout<T>::value, "The source type is not standard layout"); |
| 651 | static_assert(std::is_standard_layout<U>::value, "The target type is not standard layout"); |
| 652 | const std::size_t size = view.size() * sizeof(T) / sizeof(U); |
| 653 | DEATH_ASSERT(size * sizeof(U) == view.size() * sizeof(T), |
| 654 | ("Cannot reinterpret {} {}-byte items into a {}-byte type", view.size(), sizeof(T), sizeof(U)), {}); |
| 655 | return { reinterpret_cast<U*>(view.begin()), size }; |
| 656 | } |
| 657 | |
| 658 | /** @relatesalso ArrayView |
| 659 | @brief Reinterpret-cast a void array view |
nothing calls this directly
no test coverage detected