BUG: ClassView Cannot Add Member Functions To Template Classes
ID: Q192629
|
The information in this article applies to:
-
Microsoft Visual C++, 32-bit Editions, versions 5.0, 6.0
SYMPTOMS
The following error occurs when trying to add member functions to template
classes using ClassView:
Unable to create the implementation of this function
RESOLUTION
To add member functions to a template class, you must manually enter the
functions into the source files.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this bug and will post
new information here in the Microsoft Knowledge Base as it becomes
available.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a default MFC AppWizard (exe).
- Add a generic class to the project:
- Select the project in ClassView.
- Right-click the mouse and select New Class.
- Select Generic from the Class Type combo box.
- Give the class a name, such as CMyGenericClass, and click OK.
- Edit this generic class declaration, constructor definition, and
destructor definition by adding the template keyword along with the type
list, for example:
//generic class declaration:
template <class c> class CMyGenericClass {
public:
CMyGenericClass();
virtual ~CMyGenericClass();
};
//constructor and destructor definitions:
template <class c> CMyGenericClass<c>::CMyGenericClass()
{
}
template <class c> CMyGenericClass<c>::~CMyGenericClass()
{
}
- In ClassView, right-click CMyGenericClass and select "Add Member
Function."
- Enter the function name and return type. Click OK. A dialog box is
displayed indicating the following error:
Unable to create the implementation of this function
In Visual C++ 6.0, you do not have the ability to jump to a template
function declaration from ClassView unless the template function is defined
inside the class declaration (inline).
For additional information, please see the following article in the
Microsoft Knowledge Base:
Q154112
ClassView Cannot Find Template Member Function Definition
Additional query words:
kbDSupport
Keywords : kbClassView kbide kbVC500 kbVC500bug kbVC600 kbVC600bug kbGrpDSTools
Version : WINNT:5.0,6.0
Platform : winnt
Issue type : kbbug