Sign in to follow this  

VC.NET 2003 can't handle partial specialization of templates?

This topic is 4819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have the following test code:
template <class A, class B>
class Jack { };

template <class B>
class Jack<B, int>{};

int main() {
}

In VC.NET 2003, this fails to compile. I thought VC 2003 supported partial specialization, however. The exact error messages are: error C2065: 'B' : undeclared identifier [line 4] error C2687: cannot define a nested UDT of a template class out of line [lines 5]

Share this post


Link to post
Share on other sites
AFAIK, 2002 doesn't support but 2003 does. And that's the right syntax, I'm pretty sure. Try

template <class A>
class Jack<A, int>{};

Share this post


Link to post
Share on other sites
Quote:
Original post by Brobanx
I have the following test code:

*** Source Snippet Removed ***

In VC.NET 2003, this fails to compile. I thought VC 2003 supported partial specialization, however. The exact error messages are:

error C2065: 'B' : undeclared identifier [line 4]
error C2687: cannot define a nested UDT of a template class out of line [lines 5]

It should compile perfectly fine in .net 2003. Your errors might be caused by some other code you're not including in the post (I'm betting you missed an end curly bracket somewhere).

Share this post


Link to post
Share on other sites

This topic is 4819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this