初始提交: UE5.3项目基础框架
This commit is contained in:
18
Plugins/CesiumForUnreal/Source/ThirdParty/include/CesiumUtility/SpanHelper.h
vendored
Normal file
18
Plugins/CesiumForUnreal/Source/ThirdParty/include/CesiumUtility/SpanHelper.h
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user