Is there a plan to replace streams with byte ranges? Or should I just use streams?

I need to do some binary parsing and I found using ranges is not very comfortable. For example to read an uint I need to:

version (LittleEndian)
    auto r = retro(takeExactly(range, 4));
else
    auto r = takeExactly(range, 4);

uint u;
auto ar = (cast(ubyte*)&u)[0 .. 4];
replaceInPlace(ar, 0, 4, r);

while with streams its easier:

uint u;
stream.read(u);
version (LittleEndian)
    u = swapEndian(u);

Reply via email to