// a template function that takes an array of char
// and returns a std::string constructed from it
//
// This function safely 'converts' the array to a pointer
// to it's first element, just like the compiler would
// normally do, but this should avoid diagnostic messages
// from very restrictive lint settings that don't approve
// of passing arrays to functions that expect pointers.
template <typename T, size_t N>
std::string str( T (&arr)[N])
{
return std::string(&arr[0]);
}
上記のテンプレート関数を使用すると、次のようにリンターを通過できるはずです。
_IDs[str("key")] = str("value");
余談ですが、リントが_IDs予約名であると文句を言っていないことに驚いています.CまたはC ++では、特に大文字と一緒に使用する場合は、先頭にアンダースコアを付けないでください。