custom sorting of lists ?
Boris-Barboris
ismailsiege at gmail.com
Sun Oct 14 11:50:12 UTC 2018
On Sunday, 14 October 2018 at 01:31:26 UTC, Jonathan M Davis
wrote:
> Unless there's something about the implementation that's tied
> to the list itself, I would think that it would make more sense
> to make it a generic algorithm, then it will work with any
> non-random-access range, and it avoids needing to reimplement
> it for similar circumstances. IMHO, it really only makes sense
> to tie it to the container if the implementation itself needs
> to be for some reason.
>
> - Jonathan M Davis
All operations on collections are tied to implementation. Phobos
just intorduced range abstraction that hides iteration code (and
is still implemented by collection itself). Iteration is only a
small part of functionality that one expects from the data
structure. I'm against operation generalization, collections have
little in common besides basic semantics of insertion, they
should provide their own methods.
It is the lack of such methods that is more disheartening. And
the lack of cursor\iterator concept, wich maps well to mutation
semantics of lists\trees.
More information about the Digitalmars-d-learn
mailing list