I have a function like this:
void column(const std::string &value) { ... }
void column(float value) { ... }
template <class... TColumns> void row(const TColumns &...columns) {
ImGui::TableNextRow();
(column(columns), ...);
}
I am using clang-tidy static analyzer to make sure that my code is always compliant with cpp core guidelines. I am using this function in the following way:
// (const char[5], float)
row("Hello", 20.5f);
My understanding is that, std:string
accepts const char *
but the first argument of the function call above gets inferred to const char[5]
. This causes array decay and I get clang-tidy error that:
do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead
Is it possible to somehow enforce that string argument that is passed is always const char *
, not const char[5]
or const char[6]
etc?