[Issue 5076] std.algorithm.sorted / schwartzSorted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 19 11:16:17 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5076



--- Comment #5 from Peter Alexander <peter.alexander.au at gmail.com> 2010-10-19 11:15:30 PDT ---
(In reply to comment #4)
> array creates an array from anything. We should have a way to say "duplicate
> and preserve type".
> 
> Probably the best idea is to define an optional property ".dup" for ranges.
> Then arrays implement it automatically, and other ranges may define it as they
> find fit.

What if you don't want to preserve type?

e.g. you have a list, but you want to get a sorted array of the elements in
that list?

Why not take the best of both worlds, allowing the user to specify the new
container type, but have it default to the original type, something like:

auto transformed(alias xform, OutputRange = InputRange, InputRange)(InputRange
range)
{
  ...
}

-- 
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