That's why I think concepts are a good thing.
Container == vTable less Interfaces.
secure + documentation for free

On Sunday, 24 March 2013 at 03:55:35 UTC, Manu wrote:
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 <turkey...@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.

Reply via email to