Microsoft KB Archive/318734

= ConstructElements and DestructElements are deprecated in Visual C++ .NET and in Visual C++ 2005 =

Article ID: 318734

Article Last Modified on 1/3/2006

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-



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.

Keywords: kbtshoot kbprb kbdocerr KB318734

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.