Range documentation
Manu
turkeyman at gmail.com
Sat Mar 23 20:55:26 PDT 2013
I'd like to clarify some conflicts I've encountered.
TDPL talks about ranges, it mentions random access ranges requiring these
functions:
T at(int i)
Range slice(int x, int y)
But most code I encounter rather implements:
T opIndex(size_t i)
Range opSlice(size_t x, size_t y)
Which is it? Is there a distinction? One approach is deprecated?
Also, forward ranges require:
Range save()
But there is also this function:
Range opSlice()
With no args, handles the syntax 'range[]'. save() and opSlice() with no
args would appear to be identical.
Why have both? Which will be used in which cases?
On 24 March 2013 13:03, Manu <turkeyman at gmail.com> wrote:
> I'm trying to write some ranges with strictly controlled sets of features,
> but the docs on ranges are either very poor, or illusive (I can't find any).
>
> Suggest: Add a category under Language -> Language Reference about ranges,
> and all the stuff that defines their use/limitations. With some examples.
>
> I'm just copying from the std libs and hope I catch all the details.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130324/8a7a62af/attachment.html>
More information about the Digitalmars-d
mailing list