Simplified:
// CHAR_TYPE == char, wchar_t, ...
template
void Foo(CHAR_TYPE const (&value)[CHAR_COUNT]) no
One idea that works is to remove the pointer and simply have T
instead, with a std::enable_if_t
guard. Simplified example below:
#include
#include
template
void f(T const (&) [N])
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
template::value>* = nullptr >
void f(T)
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
int main()
{
const char* str = "test";
char str2[]{"test2"};
f(str);
f(str2);
}
Live on Coliru