9 const static std::string names[] = {
20 for (
const auto& t : primitive_types) {
44 constexpr
size_t valid_ids =
sizeof(names) /
sizeof(std::string) - 1;
45 if (
id >= 0 &&
id <= valid_ids) {
46 return std::string_view(names[
id]);
48 return std::string_view(names[valid_ids]);
std::string_view primitive_type_name(PrimitiveType t)
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
int8_t get_max_primitive_type_id(const std::vector< PrimitiveType > &primitive_types)
Get the maximum id for a list of primitive types.