[ox/model] Add string type template parameter to getModelTypeName

This commit is contained in:
Gary Talent 2021-12-01 01:34:05 -06:00
parent 2c8f4cec2c
commit 97bf81ba23

View File

@ -44,8 +44,8 @@ struct TypeNameCatcher {
};
template<typename T>
constexpr const char *getModelTypeName() noexcept {
template<typename T, typename Str = const char*>
constexpr Str getModelTypeName() noexcept {
auto a = std::allocator<T>();
auto t = a.allocate(1);
TypeNameCatcher nc;
@ -54,14 +54,14 @@ constexpr const char *getModelTypeName() noexcept {
return nc.name;
}
template<typename T>
constexpr const char *getModelTypeName(T *val) noexcept {
template<typename T, typename Str = const char*>
constexpr Str getModelTypeName(T *val) noexcept {
TypeNameCatcher nc;
oxIgnoreError(model(&nc, val));
return nc.name;
}
template<typename T>
constexpr auto ModelTypeName_v = getModelTypeName<T>();
template<typename T, typename Str = const char*>
constexpr auto ModelTypeName_v = getModelTypeName<T, Str>();
}