K
Kevin Grigorenko
Hello all,
Okay, I've got a templated class that that takes an int and a char *, but
when I try to instantiate an object of that template, VS.NET complains with:
error C2975: 'S' : invalid template argument for 'TextDB::TextDB_Version',
constant expression expected
template<int N, char *S>
class TextDB_Version
{
[...]
};
#define TDB_DEFAULT_DELIMITER "."
class TextDB
{
private:
TextDB_Version<3, TDB_DEFAULT_DELIMITER> myVersion;
};
I can't understand what's wrong with this. It seems to me from
documentation that I should be able to use char *'s as literal template
arguments, what am I missing here? I tried taking out the #define and put
in just a string there, TextDB_Version<3, "."> myVersion; and that had the
same error obviously.
Thanks for everyone's time,
Kevin Grigorenko
Okay, I've got a templated class that that takes an int and a char *, but
when I try to instantiate an object of that template, VS.NET complains with:
error C2975: 'S' : invalid template argument for 'TextDB::TextDB_Version',
constant expression expected
template<int N, char *S>
class TextDB_Version
{
[...]
};
#define TDB_DEFAULT_DELIMITER "."
class TextDB
{
private:
TextDB_Version<3, TDB_DEFAULT_DELIMITER> myVersion;
};
I can't understand what's wrong with this. It seems to me from
documentation that I should be able to use char *'s as literal template
arguments, what am I missing here? I tried taking out the #define and put
in just a string there, TextDB_Version<3, "."> myVersion; and that had the
same error obviously.
Thanks for everyone's time,
Kevin Grigorenko