On Tuesday, 27 May 2014 at 16:49:42 UTC, BicMedium wrote:
But there could be a templated-unittest for those kind of things...Ranges are relatively straightforward in to use, but when you want to implement one, it's another thing...So it's just about indexes ? And a kind of State machine for indexes (push/pop) ?
We can't wright a generic unittest to make sure that a range "works". Indeed, depending on *what* your range iterates, the test would be different.
You just have to test that yourself.
I hardly get how to make my easy containers range-aware. but I want to, because of std.algo.
The easiest way is to give your container the "Range opSlice()" function, where Range is the range you defined to iterate on your container. See std.container.array.