Range's opSlice(/**/) function

monarch_dodra monarch_dodra at gmail.com
Tue Jul 10 14:35:02 PDT 2012


I've noticed that some ranges in Phobos don't implement 
"opSlice(/**/)", when they provide "opSlice(indexLow, indexHigh)".

For example, algorithm.map, or Array.Range don't provide it.

I was wondering if this was just an oversight of the 
implementation, or if there was a special reason to choose not to 
provide it.

I've taken to writing: "writeln(stuff[])" whenever I want to 
print a collection of things, to make sure I don't just print the 
name of the "stuff" class. I don't stop and wonder if stuff is a 
range or not, and just append it []. I was surprised it did not 
work consistently.

...Or is there a reason I should stop writing "stuff[]"?


More information about the Digitalmars-d mailing list