Active Template Library (ATL) contains a lot of useful classes but not for sorting. There are collections classes, including CAtlArray but it does not have sorting capabilities.
I would like to share quite simple C++ templates that sort.
The sample projects illustrates 3 sorting cases:
- Array of ordinal values that compare one to another; sorting uses comparison operator to order values.
- Array of complex values that do not compare one to another directly and a custom comparison function is required; sorting uses “traits” class to perform such comparison.
- Array of references (indexes, pointers); “traits” class is provided to sort function along with custom parameter which is also passed to comparison function.
Sample project source code: ATL Sort.zip // VC++.NET 2003, Console application project with ATL support
Source code was lost as a result of an incident, but thanks to Philipp K. it is re-uploaded back.