Just for clarification, I wanted 'myrange.at(i)' to be the same as
`myrange.dropExactly(i).front`
(so I don't assume it's a random access range).

>> myrange.dropExactly(i).front makes it much more obvious what you're
doing and that it's inefficient. It might be necessary in some cases, but
we don't want to give the impression that it's cheap, which at() would do.

I think it's already clear that it's potentially O(n) [n=i] cost as we're
not using myrange[i]. But fine, call it atWalk/walkAt/whatever. Point is
it's a common enough operation.





On Sat, Jul 26, 2014 at 11:15 AM, monarch_dodra via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:

> On Saturday, 26 July 2014 at 00:28:32 UTC, Ary Borenszweig wrote:
>
>> No, the OP said the meaning was `myrange.dropExactly(i).front`, which is
>> not a random access.
>>
>> Sometimes you *do* want the n-th element of a range even if the range is
>> not a random access.
>>
>
> What he did also say is he wanted the equivalent of C++'s "at", which is
> the equivalent of "checked random-access" (or "checked dictionary access").
>
> So the actual requirements aren't very clear. In terms of "C++ at"
> equivalent, I don't think we have anything equivalent to offer. That said,
> I've never seen anyone use "at" in C++ ever. I'd assume it's more of a
> java/C# thing to do checked accesses?
>
>

Reply via email to