Improve the sort interace

Description

We need a single sorting function called "sort" that calls the best sorting algorithm depending on the platform. We want to make this as simple as possible. In most cases people don't care about the specific algorithm as long as it is good. For cases where other algorithms are appropriate, we can provide specifically named functions.

Where should sorting algorithms be located? Maybe in the "algorithm" header like in C++.

We also need to support sorting structures other than C-style arrays. At a minimum, dynamic_array. If possible, using the STL-style interface that uses iterators would be my first choice. However, this might cause problems with the pointer swapping used in merge_sort(). If there is some way to determine the data structure pointed to by an iterator, then we could declare a second version of the data structure and do iterator swapping. But, is this necessary? Which data structures should sort work for anyway?

Change History

This ticket is partially duplicated by #4093. That ticket covers the single sort function. The rest of this ticket is valid, though, so I'm leaving it open. What is the best interface for our sorting functions?