[Issue 5076] std.algorithm.sorted / schwartzSorted
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 19 13:32:45 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5076
--- Comment #6 from bearophile_hugs at eml.cc 2010-10-19 13:32:04 PDT ---
(In reply to comment #4)
> array creates an array from anything. We should have a way to say "duplicate
> and preserve type".
After thinking about your words for some time I have understood your point.
So after your change, for the semantics I am looking for, I'll need to write a
bit longer code:
sorted(array(some_linked_list))
What if the input collection is not sortable? Like:
sorted(some_hash_set)
In that case I presume the compilation will fail, and I'll have to use
something like:
sorted(array(some_hash_set))
Or even:
sorted(toList(some_hash_set))
(Where toList() is similar to array() but produces some kind of list out of an
iterable).
A problem in using this:
sorted(array(some_linked_list))
is that array() is supposed to create an array duplicate of the collection, and
then sorted() is supposed to create a second useless copy of it.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list