<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 27, 2014 at 9:20 PM, H. S. Teoh via Digitalmars-d-learn <span dir="ltr"><<a href="mailto:digitalmars-d-learn@puremagic.com" target="_blank">digitalmars-d-learn@puremagic.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Sun, Jul 27, 2014 at 07:42:17PM -0700, Timothee Cour via Digitalmars-d-learn wrote:<br>
> Just for clarification, I wanted '<a href="http://myrange.at" target="_blank">myrange.at</a>(i)' to be the same as<br>
> `myrange.dropExactly(i).front`<br>
> (so I don't assume it's a random access range).<br>
><br>
> >> myrange.dropExactly(i).front makes it much more obvious what you're<br>
> doing and that it's inefficient. It might be necessary in some cases,<br>
> but we don't want to give the impression that it's cheap, which at()<br>
> would do.<br>
><br>
> I think it's already clear that it's potentially O(n) [n=i] cost as<br>
> we're not using myrange[i]. But fine, call it atWalk/walkAt/whatever.<br>
> Point is it's a common enough operation.<br>
</div>[...]<br>
<br>
You could just define your own function for it, right?<br>
<br>
        // or call it whatever you want<br>
        auto getNth(R)(R range, size_t index)<br>
                if (isInputRange!R)<br>
        {<br>
                return range.dropExactly(index).front;<br>
        }<br>
<br>
<br>
T<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Making non-nullable pointers is just plugging one hole in a cheese grater. -- Walter Bright<br>
</font></span></blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Obviously I did that, but I thought it belonged in phobos. Anyway, closing this.</div></div>