--- Comment #5 from Jonathan M Davis <> 2012-10-18 16:14:42 
PDT ---
> I mean a Phobos range as
> InputRange: requires the empty, front and popFront() member functions

Yeah. And arrays have that via std.array.empty, std.array,front, and
std.array.popFront. So, the array that you get from slicing MmFile is a fully
functional range. It's even random-access with slicing and length, so it
supports pretty much every range-based function there is. Making MmFile itself
a range wouldn't gain you anything. And in fact, making it a range would be a
_bad_ idea for the same reason that making any container a range is a bad idea
- iterating over it would consume it. You wouldn't want to do something like

auto mmFile = new MmFile("filename");

After that call to popFront, you would no longer have access to the first byte
of the file without creating a new MmFile, which is almost certainly not what
you want. Rather, what you really want is a range which contains all of the
bytes in the file and allows you to operate on them without affecting MmFile,
and slicing MmFile to get an array works great for that.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to