• Advertisement
Sign in to follow this  

Template Problem

This topic is 4558 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'm trying to compile this peice of code and get an error message about template explicit specification before definition under Visual C++ 6. template<class T> union myunion { ....... }; template<class T> class myclass { .......... union myunion<T> *p; }; What's the problem here? I'm passing the same type to be used for the union in the class. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
What error number is this? Often, searching Google for that number'll give you everything you need to know.

Also, consider that VC6 has legendary template support. Or lack thereof.

CM

Share this post


Link to post
Share on other sites
Quote:
Original post by quaker
If I wanted to search it on google I would not post it here.

Well then why not provide a better description of your problem? Post actual code that breaks, not an approximation of what you think might be causing the problem -- and then give us the exact error you are getting rather than "an error message about template explicit specification" which doesn't even make sense. Did you mean explicit template specialization possibly? It is not our responsibility to try to figure out what you mean. Take the little time that it takes to form a better description of the situation.

Share this post


Link to post
Share on other sites
Quote:
Original post by quaker
If I wanted to search it on google I would not post it here.


If you actually want an answer here you shouldn't have posted this reply either.
There's a certain etiquette to asking questions on a forum. I'll post the link again: Asking Questions the Smart Way .

Anyway - try removing the "union" tag before the union member declaration. That strikes me as a C-ism - though I don't have a VC6.0 to test if that is the problem.

I.e.

// instead of
// union myunion<T> *p
myunion<T> *p;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement