Files

19 lines
529 B
C
Raw Permalink Normal View History

2025-10-14 11:14:54 +08:00
#pragma once
#include <span>
namespace CesiumUtility {
/**
* @brief This function converts between span types. This function
* has the same rules with C++ reintepret_cast
* https://en.cppreference.com/w/cpp/language/reinterpret_cast. So please use it
* carefully
*/
template <typename To, typename From>
std::span<To> reintepretCastSpan(const std::span<From>& from) noexcept {
return std::span<To>(
reinterpret_cast<To*>(from.data()),
from.size() * sizeof(From) / sizeof(To));
}
} // namespace CesiumUtility