[ox/model] Add requireModelTypeName

This commit is contained in:
Gary Talent 2021-12-01 02:29:01 -06:00
parent eef1bfcbd6
commit 7aead742eb

View File

@ -61,6 +61,13 @@ constexpr Str getModelTypeName(T *val) noexcept {
return nc.name;
}
template<typename T>
consteval auto requireModelTypeName() noexcept {
constexpr auto name = getModelTypeName<T>();
static_assert(ox_strcmp(name, "") != 0, "TypeName is required");
return name;
}
template<typename T, typename Str = const char*>
constexpr auto ModelTypeName_v = getModelTypeName<T, Str>();