[ox/model] Add string type template parameter to getModelTypeName
This commit is contained in:
parent
2c8f4cec2c
commit
97bf81ba23
12
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
12
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
@ -44,8 +44,8 @@ struct TypeNameCatcher {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename Str = const char*>
|
||||||
constexpr const char *getModelTypeName() noexcept {
|
constexpr Str getModelTypeName() noexcept {
|
||||||
auto a = std::allocator<T>();
|
auto a = std::allocator<T>();
|
||||||
auto t = a.allocate(1);
|
auto t = a.allocate(1);
|
||||||
TypeNameCatcher nc;
|
TypeNameCatcher nc;
|
||||||
@ -54,14 +54,14 @@ constexpr const char *getModelTypeName() noexcept {
|
|||||||
return nc.name;
|
return nc.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename Str = const char*>
|
||||||
constexpr const char *getModelTypeName(T *val) noexcept {
|
constexpr Str getModelTypeName(T *val) noexcept {
|
||||||
TypeNameCatcher nc;
|
TypeNameCatcher nc;
|
||||||
oxIgnoreError(model(&nc, val));
|
oxIgnoreError(model(&nc, val));
|
||||||
return nc.name;
|
return nc.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T, typename Str = const char*>
|
||||||
constexpr auto ModelTypeName_v = getModelTypeName<T>();
|
constexpr auto ModelTypeName_v = getModelTypeName<T, Str>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user