-
March 25th, 2004, 02:11 PM
#1
Operator template specialization
[Sorry for posting this accidentally over in the graphics forum. It should be in this forum.]
Can anyone tell me why the following code compiles under GCC but not with MSVC? MSVC cannot parse the code properly.
class Foo
{
};
template<typename T1> void operator<<(Foo&, T1){}
template<> void operator<< <int>(Foo&, int){}
It says "error C2143: syntax error : missing ';' before '<'" Thus, it is failing to parse the <int> after the << operator. GCC has no problem with it.
-
March 25th, 2004, 04:11 PM
#2
an anyone tell me why the following code compiles under GCC but not with MSVC? MSVC cannot parse the code properly.
That's because VC++ 6.0 is broken. If your template uses anything that is sophisticated, you basically crosss your fingers and hope it compiles with 6.0. Otherwise you need to code a workaround that works with 6.0, or upgrade to VC++ 7.x
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|