[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>
|
||||
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>();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user