The following quote is from C++ Templates by Addison Wesley. Could someone please help me understand in plain English/layman\'s terms its gist?
It means you can't do this...
#include
template
void f() { std::cout << P << '\n'; }
int main()
{
f<"hello there">();
}
...because "hello there" isn't 100% guaranteed to resolve to a single integral value that can be used to instantiate the template once (though most good linkers will attempt to fold all usages across linked objects and produce a new object with a single copy of the string).
You can, however, use extern character arrays/pointers:
...
extern const char p[];
const char p[] = "hello";
...
f();
...