"invisible" template class functions

Started by
3 comments, last by Sparkle 24 years ago
I have created a template class for a doubly-linked list. But the member functions do not show up in ClassView or in the Intellisense popup box, only the member variables. Is there a way of making them do so? My function definitions are placed in the same file as the class itself, right below the class. The functions show up as long as they aren''t declared as templates (but that renders the class useless, of course). It''s not a BIG problem, the class works fine, but it is a little annoying having to remember and type the whole function names every time I use it. Anyway, thanx for any help. *Sparkle*
Advertisement
The problem here is that a specific instance of your class doesn''t really exist until compile time. The member variables of a static type can be included in the class view, but there is really no easy way for signatures of the templated functions to be determined prior to compile time since there are literaly and infinite number of possibilities for each function.

That said, I''m sure it would have been possible to support templated functions in class view, but it would have taken a bit more work (although it really should have been done)

Check out the GPI project today!
Actually chippydip, if you create a class, it should instantly appear in ClassView when you finish.

I suggest you create the new class with the New Class wizard (unless thats what you did, but then it would appear in ClassView), because that way you KNOW the compiler will aknowledge the fact that the class exists. To fix this, just cut all your current template class code, delete any new files that were created just for the class, and use New Class Wizard. Trust me, it makes it 10x easier!
I did some searching in the MSDN library. Here''s what I found:

quote:
When a template member function is defined outside of the template class, it does not appear in an instantiated template object''s Member list, and does not provide Parameter and Type Info. It also does not appear in the ClassView pane. With Visual C++ 6.0, the only way to have IntelliSense work correctly with template member functions is to define all member functions inside of the template class declaration.


I guess I''ll have to do without, the class gets really ugly with all the member functions defined inside the class.
Sorry to have bothered you without checking up on things first.

*Sparkle*
Is that actually the case even with non-template member functions in a template class? Because if you''re using member templates, I''m wondering why. Generally, there are a few instances where they''re nice, but they aren''t really necessary (STL''s vector, for example, has two template members IIRC). Of course, if ClassView doesn''t work with ANY members of a template class, they should think about fixing it...

-Brian

This topic is closed to new replies.

Advertisement