Add these to Phobos?

Jonathan M Davis jmdavisProg at gmx.com
Mon Oct 15 23:21:04 PDT 2012


On Tuesday, October 16, 2012 03:47:43 Jonathan M Davis wrote:
> And if SortedRange is changed to provide access to its underlying range via
> a member named source (it was recently suggested by Andrei that we should
> standardize on doing that where appropriate), then it could become a one-
> liner:
> 
> auto result = sort(array(range)).source;

Actually, it looks like SortedRange already provides access to the range that 
it wraps via release. It returns the wrapped range and removes it from the 
SortedRange, which is actually better than source, because if SortedRange had 
source, then it would be possible to make it so that it wasn't sorted anymore. 
In any case, that means that the one line becomes

auto result = sort(array(range)).release();

- Jonathan M Davis


More information about the Digitalmars-d mailing list