Skip to content

Views, sort_copy, online algorithms... #42

Open
@Morwenn

Description

@Morwenn

cpp-sort currently only cares about in-place sorting algorithms: algorithms that mutate the passed collection and don't return anything (except when they do), which is pretty much enough for people most of the time. However, I believe that there is some value in having algorithms that actually copy a sorted equivalent of the passed collection into the library. It once again leads to maaaaany design decisions depending on how we want to implement that:

  • Have a cppsort::sort_copy function in the library taking a sorter (or defaulting to default_sorter) and an additional OutputIterator parameter?
  • Provide an equivalent cppsort::sort_move function?
  • Create a cppsort::sorted function that takes an iterable and returns a new instance of the same iterable? Make it work with an OutputIterator instead? Have it take any sorter like cppsort::sort?
  • Add a cppsort::sorted_view returning a range with sorted iterators which, when iterated, corresponds to a sorted view of the original collection? It's pretty much what indirect_adapter does in the first place, but decoupling it from the adapter might also be interesting.
  • Have first-class support for online sorting algorithm? Adding an is_online property in cppsort::sorter_traits is easy, but how to use it properly?

An interesting algorithm about incremental sort that might provide some idea and/or insights about online/incremental sorting: http://larshagencpp.github.io/blog/2016/04/23/fast-incremental-sort

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions