On 03/09/2016 06:50 PM, rcorre wrote:
> sort calls to quicksort (for unstable, at least) which uses
> swapAt. swapAt takes the range by value, so it just swaps the values in
> its local copy.
Remembering that a range is not the collection, swapAt takes the range
by value but it does not copy th
On Wednesday, 9 March 2016 at 16:53:08 UTC, Xinok wrote:
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
That's my suspicion as well. It seems that OnlyResult is
pas
On Wed, 09 Mar 2016 14:28:11 +, cym13 wrote:
> Note that an input range isn't even remotely a container
Which is why sort() has template constraints beyond isInputRange. The
constraints ensure that it is possible to swap values in the range.
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
That's my suspicion as well. It seems that OnlyResult is
pass-by-value so every time it gets passed to another functio
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
Note that an input range isn't even remotely a container, it's
a way to iterate on a container. As you don't have all elements
at hand you can't sort them, that's why you have to use array
here.
Oh, I think it just clicked. I was thin
On Wednesday, 9 March 2016 at 15:39:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
Still curious as to why it fails; maybe the range is getting
copied at some point? I guess I need to step through it.
I did try different SwapStrategies with no luck.
Since you
On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an array:
import std.array : array;
assert(only(3,1,2).arra
On Wednesday, 9 March 2016 at 13:04:31 UTC, rcorre wrote:
On Wednesday, 9 March 2016 at 12:31:18 UTC, Edwin van Leeuwen
wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http:/
On Wednesday, 9 March 2016 at 12:31:18 UTC, Edwin van Leeuwen
wrote:
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http://github.com/BlackEdder/ggplotd/blob/master/source/ggplotd/r
On Wednesday, 9 March 2016 at 12:21:55 UTC, rcorre wrote:
If you are looking for a lazy uniq that works on non sorted
ranges, I implemented one not to long ago:
http://github.com/BlackEdder/ggplotd/blob/master/source/ggplotd/range.d
That sounds like the kind of thing I was looking for. I'll ta
On Wednesday, 9 March 2016 at 09:15:01 UTC, Edwin van Leeuwen
wrote:
I'm not sure why your fix didn't work, but generally I work
around this by converting the OnlyResult into an array:
import std.array : array;
assert(only(3,1,2).array.sort.equal(only(1,2,3)));
I'd like to avoid allocating
On Wednesday, 9 March 2016 at 03:05:52 UTC, rcorre wrote:
I was in a situation where I wanted to remove duplicates from
an OnlyResult.
To do this with uniq, I needed to sort it. OnlyResult doesn't
satisfy the template constraints of sort, but this seems easy
enough to fix. I made front, back, a
I was in a situation where I wanted to remove duplicates from an
OnlyResult.
To do this with uniq, I needed to sort it. OnlyResult doesn't
satisfy the template constraints of sort, but this seems easy
enough to fix. I made front, back, and opIndex return by ref.
With this, the following compile
14 matches
Mail list logo