ConstructElements and DestructElements are deprecated in Visual C++ .NET and in Visual C++ 2005 (318734)



The information in this article applies to:

  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)

This article was previously published under Q318734

SUMMARY

When you migrate your MFC projects from Microsoft Visual C++ 6.0 to Microsoft Visual Studio .NET or Microsoft Visual Studio 2005, you may receive compiler warnings that are similar to the following warnings if you override the ConstructElements and DestructElements global helper functions:
warning C4995: 'ConstructElements': name was marked as #pragma deprecated
warning C4995: 'DestructElements': name was marked as #pragma deprecated
The warnings only inform you that those functions are deprecated. But they do not provide any information about what classes or functions must be used instead in Visual C++ .NET or in Visual C++ 2005.

MORE INFORMATION

In Visual C++ 6.0, the MFC template-based collection classes CArray, CList, and CMap use the following seven global helper functions that you can customize for your derived collection class:
  • CompareElements
  • ConstructElements
  • CopyElements
  • DestructElements
  • DumpElements
  • HashKey
  • SerializeElements
In Visual C++ .NET, the MFC collection classes (CArray, CList and CMap) use five global helper functions (CompareElements, CopyElements, DumpElements, HashKey and SerializeElements) that you can customize for your derived collection class. ConstructElements and DestructElements are deprecated, and the collection classes (CArray, CList and CMap) now call the constructor and destructor of the data type they contain to do the job.

Modification Type:MajorLast Reviewed:1/3/2006
Keywords:kbtshoot kbdocerr kbprb KB318734 kbAudDeveloper