const usage with reintepret cast
suresh.t@philips.com
suresh.t@philips.com
Wed Jan 19 12:27:00 GMT 2005
hi,
I have a query. This might be basic but it will be nice if someone can
explain why it doesnt work
I presumed that in the below code (which is in global scope) byte0 will be
a const and i could use it as a template parameter. But the moment i try
to use it as a template parameter i get an error like "non-constant
`byte0' cannot be used as template argument"
const unsigned data = 0x41424344;
const unsigned char byte0 = reinterpret_cast<const unsigned
char*>(&data)[0];
I get the error when i try to use it in some template like:
template<std::size_t s>
struct ab{
};
template<>
struct ab<byte0> { //complains about the byte0 use here!!
};
Thanks in advance
---------------------------------------------------------------------------------------------------------
Warm Regards,
Suresh.T
More information about the Gcc-help
mailing list