Re: Retrieving the traversed range

2010-08-29 Thread Peter Alexander
On 29/08/10 2:01 AM, Andrei Alexandrescu wrote: On 08/28/2010 07:06 PM, Manfred_Nowak wrote: In your OP you wrote: but Until is (correctly) not bidirectional I recognize at least a misunderstanding in this sentence, because every bidirectionalRange _is_ an inputRange. Therefore `Until!' _shou

Re: Retrieving the traversed range

2010-08-28 Thread Andrei Alexandrescu
On 08/28/2010 07:06 PM, Manfred_Nowak wrote: Peter Alexander wrote: That would be all well and good if inPlaceSplit actually existed :) In your OP you wrote: but Until is (correctly) not bidirectional I recognize at least a misunderstanding in this sentence, because every bidirectionalRang

Re: Retrieving the traversed range

2010-08-28 Thread Manfred_Nowak
Peter Alexander wrote: > That would be all well and good if inPlaceSplit actually existed :) In your OP you wrote: > but Until is (correctly) not bidirectional I recognize at least a misunderstanding in this sentence, because every bidirectionalRange _is_ an inputRange. Therefore `Until!' _shou

Re: Retrieving the traversed range

2010-08-28 Thread Robert Jacques
On Sat, 28 Aug 2010 15:45:17 -0400, Peter Alexander wrote: On 28/08/10 12:03 PM, Manfred_Nowak wrote: Andrei Alexandrescu wrote: Thx, but then I am missing the whole point of this thread. It's simple: the OP wanted this: - start with a bidir range r - move from the LEFT in it for a while

Re: Retrieving the traversed range

2010-08-28 Thread Peter Alexander
On 28/08/10 12:03 PM, Manfred_Nowak wrote: Andrei Alexandrescu wrote: Thx, but then I am missing the whole point of this thread. It's simple: the OP wanted this: - start with a bidir range r - move from the LEFT in it for a while (prefix, postfix)= inPlaceSplit( r, predicate, Move.RIGHT)

Re: Retrieving the traversed range

2010-08-28 Thread Manfred_Nowak
Andrei Alexandrescu wrote: >> Thx, but then I am missing the whole point of this thread. > It's simple: the OP wanted this: > - start with a bidir range r > - move from the LEFT in it for a while (prefix, postfix)= inPlaceSplit( r, predicate, Move.RIGHT) // == O(prefix.len) > - then reve

Re: Retrieving the traversed range

2010-08-27 Thread Andrei Alexandrescu
On 8/27/10 16:38 PDT, Manfred_Nowak wrote: Andrei Alexandrescu wrote: retro is O(1) today. Thx, but then I am missing the whole point of this thread. It's simple: the OP wanted this: - start with a bidir range r - move from the LEFT in it for a while - then reverse whatever is to the LEF

Re: Retrieving the traversed range

2010-08-27 Thread Manfred_Nowak
Andrei Alexandrescu wrote: > retro is O(1) today. Thx, but then I am missing the whole point of this thread. -manfred

Re: Retrieving the traversed range

2010-08-27 Thread Andrei Alexandrescu
On 8/26/10 18:11 PDT, Manfred_Nowak wrote: Andrei Alexandrescu wrote: we should do this for Phobos too Why is it undesirable to be able to retro in O(1)? I've seen your other post, but couldn't connect the dots. retro is O(1) today. Andrei

Re: Retrieving the traversed range

2010-08-27 Thread Manfred_Nowak
Andrei Alexandrescu wrote: > we should do this for Phobos too Why is it undesirable to be able to retro in O(1)? -manfred

Re: Retrieving the traversed range

2010-08-26 Thread Andrei Alexandrescu
On 8/25/10 6:55 PDT, Peter Alexander wrote: Thanks for the replies Andrei, Steven. It's a bit disappointing that there is no solution to this, although I think you already know what I'll suggest as a solution :) (cursors/iterators) It's quite funny really, because I had decided to drop the whol

Re: Retrieving the traversed range

2010-08-25 Thread Andrei Alexandrescu
On 8/25/10 14:09 PDT, Simen kjaeraas wrote: Andrei Alexandrescu wrote: This is an annoying limitation of bidirectional ranges that we don't have a solid solution to. Let me put on the table the unacceptable solution as a baseline: auto n = walkLength(r) - walkLength(until!pred(r)); popBackN(r

Re: Retrieving the traversed range

2010-08-25 Thread Simen kjaeraas
Andrei Alexandrescu wrote: This is an annoying limitation of bidirectional ranges that we don't have a solid solution to. Let me put on the table the unacceptable solution as a baseline: auto n = walkLength(r) - walkLength(until!pred(r)); popBackN(r, n); reverse(r); Of all ranges, bidirec

Re: Retrieving the traversed range

2010-08-25 Thread Manfred_Nowak
Andrei Alexandrescu wrote: > Of all ranges, bidirectional ranges suffer of this limitation because > they clearly have two underlying "ends" that are inaccessible in > separation from the range. Therefore one has to access them within the range. As far as I can see the current implementation m

Re: Retrieving the traversed range

2010-08-25 Thread Peter Alexander
Thanks for the replies Andrei, Steven. It's a bit disappointing that there is no solution to this, although I think you already know what I'll suggest as a solution :) (cursors/iterators) It's quite funny really, because I had decided to drop the whole iterator thing and just accept that the occa

Re: Retrieving the traversed range

2010-08-25 Thread Steven Schveighoffer
On Wed, 25 Aug 2010 09:10:18 -0400, Andrei Alexandrescu wrote: On 8/25/10 1:08 PDT, Peter Alexander wrote: Maybe I'm missing something, but I can't think of anyway *at all* to do this generically. Lets say I have some arbitrary bidirectional range, R, and I want to find the first element th

Re: Retrieving the traversed range

2010-08-25 Thread Andrei Alexandrescu
On 8/25/10 1:08 PDT, Peter Alexander wrote: Maybe I'm missing something, but I can't think of anyway *at all* to do this generically. Lets say I have some arbitrary bidirectional range, R, and I want to find the first element that satisfies some predicate. After that, I want to reverse the part

Re: Retrieving the traversed range

2010-08-25 Thread Steven Schveighoffer
On Wed, 25 Aug 2010 04:08:00 -0400, Peter Alexander wrote: Maybe I'm missing something, but I can't think of anyway *at all* to do this generically. Lets say I have some arbitrary bidirectional range, R, and I want to find the first element that satisfies some predicate. After that, I wa

Re: Retrieving the traversed range

2010-08-25 Thread Peter Alexander
Sorry, I should have mentioned this, but creating a copy of the range into a newly allocated array is absolutely not acceptable (this operation should require zero memory overhead). For reference, this is trivially achievable in C++: std::reverse(R.begin(), std::find_if(R.begin(), R.end(), pred))

Re: Retrieving the traversed range

2010-08-25 Thread Simen kjaeraas
Peter Alexander wrote: Maybe I'm missing something, but I can't think of anyway *at all* to do this generically. Lets say I have some arbitrary bidirectional range, R, and I want to find the first element that satisfies some predicate. After that, I want to reverse the part of the range

Retrieving the traversed range

2010-08-25 Thread Peter Alexander
Maybe I'm missing something, but I can't think of anyway *at all* to do this generically. Lets say I have some arbitrary bidirectional range, R, and I want to find the first element that satisfies some predicate. After that, I want to reverse the part of the range up to that element. Essenti