K
Kyle Kolander
I would like one of my template parameters to be an std::string.
I realize this is a non-type and non-integral value.
What options are available to me?
template <class T, string S> // not allowed
class A {...};
I can get this to compile as follows:
template <class T, const string& S>
class A {...};
string s("some string");
A<int, s> a;
However, if my definition of s is:
const string s("some string");
It will not compile... unfortunately, I am working with a lot of previously
defined const strings.
I imagine there is an elegant solution to this problem... Anyone have a
suggestion/solution?
Thanks,
Kyle
I realize this is a non-type and non-integral value.
What options are available to me?
template <class T, string S> // not allowed
class A {...};
I can get this to compile as follows:
template <class T, const string& S>
class A {...};
string s("some string");
A<int, s> a;
However, if my definition of s is:
const string s("some string");
It will not compile... unfortunately, I am working with a lot of previously
defined const strings.
I imagine there is an elegant solution to this problem... Anyone have a
suggestion/solution?
Thanks,
Kyle