S
Severin Ecker
Hi,
I have the following piece of template code which works on VC7.1 and
gcc4.1.1 without any warning or error, but CodeWarrior complains about
an "illegal explicit template specialization".
So I wanted to know whether my code is correct or if CodeWarrior
rightfully yells at me.
Btw, if I remove the inline at [1] I get an error due to a multiply
defined symbol. I guess this is correct (?) but if so, can someone shade
some light on this for me because I don't quite understand the why.
many thanks in advance!
template <bool P> struct GetRetVal
template <class T>
static T Get(void) {
//some code here
}
};
template <> struct GetRetVal<false> {
template <class T>
static T Get(void) {
//some code here
}
};
//codewarrior complains at line [2].
//Oddly enough he shuts up if I add a second tempalte<>,
//which breaks it with the other compilers.
[0] template <>
[1] inline
[2] void GetRetVal<false>::Get<void>(void)
[3] {
[4] }
best regards,
severin
I have the following piece of template code which works on VC7.1 and
gcc4.1.1 without any warning or error, but CodeWarrior complains about
an "illegal explicit template specialization".
So I wanted to know whether my code is correct or if CodeWarrior
rightfully yells at me.
Btw, if I remove the inline at [1] I get an error due to a multiply
defined symbol. I guess this is correct (?) but if so, can someone shade
some light on this for me because I don't quite understand the why.
many thanks in advance!
template <bool P> struct GetRetVal
template <class T>
static T Get(void) {
//some code here
}
};
template <> struct GetRetVal<false> {
template <class T>
static T Get(void) {
//some code here
}
};
//codewarrior complains at line [2].
//Oddly enough he shuts up if I add a second tempalte<>,
//which breaks it with the other compilers.
[0] template <>
[1] inline
[2] void GetRetVal<false>::Get<void>(void)
[3] {
[4] }
best regards,
severin