Ticket #4086 (accepted enhancement)

Opened 6 years ago

Last modified 6 years ago

Improve the sort interace

Reported by: gemacke Owned by: gemacke
Priority: normal Milestone: 1.2
Version: 1.0 Severity: normal
Keywords: Cc:

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

comment:1 Changed 6 years ago by gemacke

  • Status changed from new to accepted

comment:2 Changed 6 years ago by gemacke

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?

comment:3 Changed 6 years ago by gemacke

  • Milestone changed from 1.1 to 1.2
Note: See TracTickets for help on using tickets.