I am writing a specialised container class, and want to make it work like a normal array with range functions. After some struggle, I look at the code for std.container.array and see this comment :

When using `Array` with range-based functions like those in `std.algorithm`, * `Array` must be sliced to get a range (for example, use `array[].map!`
 * instead of `array.map!`). The container itself is not a range.


I had thought the compiler would make a generic random access range that works with the built in array for anything else with a simililar interface, but it doesn't.

Does that mean it is not possible to have a library container implementation that works nicely with range algorithms ? Do you have to slice it like the comment suggests ?


Reply via email to