I have an array called g_Parameters that I am looking to sort alphabetically in a new array called g_SortedParameters.
I have provided the code for the array. I need to sort it alphabetically to use in a log, but without g_Parameters itself being sorted alphabetically as other code relies on the indexing as it stands.
const unsigned long ParamsCount = 6;
const TCHAR * const g_Parameters[ParamsCount] =
{ TEXT("AllowFatal"), TEXT("Variant"), TEXT("EnableLogs"),
TEXT("AllowRescan"), TEXT("Path"), TEXT("Filter"),
};
I would appreciate any help with sorting this array into a new array. I'm happy to provide more information if it is required.
std::sort?std::copyand sort the copy withstd::sort, but I'm not sure how well is that working with winapi.std::partial_sort_copy()can be used to copy and sort at the same time without modifying the original.ParamsCount = 3? I would count 6 elements in array. but missing{.