#pragma once #include #include namespace NUnifiedAgent { namespace NPrivate { using TEnumNames = TVector; template TEnumNames* BuildEnumNames() { const auto names = GetEnumNames(); TEnumNames* result = new TEnumNames(names.size()); size_t index = 0; for (const auto& p: names) { Y_ABORT_UNLESS(static_cast(p.first) == index); (*result)[index++] = &p.second; } return result; } template const TEnumNames& EnumNamesVec() { static const TEnumNames* EnumNames = BuildEnumNames(); return *EnumNames; } } template >> inline const TString& NameOf(TEnum val) noexcept { return *NPrivate::EnumNamesVec()[static_cast(val)]; } }