FIX: Listing Sort Function Removes Elements (240014)
The information in this article applies to:
- The Standard C++ Library, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q240014 SYMPTOMS
If a list has over 32K elements, list::sort removes the elements.
Please refer to the Sample Program in the MORE INFORMATION section for details.
RESOLUTION
The bug is in the header file <list>.
In the sort() function:
if (_I == _MAXN)
//_A[_I].merge(_X); /* remove this line and add the line below*/
_A[_I - 1].merge(_X);
In the sort(_Pr3 _Pr) function :
if (_I == _MAXN)
//_A[_I].merge(_X, _Pr); /* remove this line and add the line below*/
_A[_I - 1].merge(_X, _Pr);<BR/>
If you are sorting through a list larger than 32K, increasing _MAXN from 15 to 25 would improve the performance. NOTE: Since the resolution involves modifying a system header file, extreme care should be taken to make sure nothing else is changed in the header file. Microsoft is not responsible for any problems resulting due to unwanted changes to the system header files.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This problem was corrected in Microsoft Visual C++ .NET.
Modification Type: | Major | Last Reviewed: | 12/8/2003 |
---|
Keywords: | kbBug kbfix kbLangCPP kbNoUpdate kbSTL KB240014 |
---|
|