std.stream.MemoryStream deprecated, range is the alternative?

chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 6 10:01:30 PDT 2015


class Test {
     MemoryStream m_stream;

     this(MemoryStream stream) {
         m_stream = stream;
     }

     void write(byte val) {
         m_stream.write(val);
     }

     byte read() {
         byte val;
         m_stream.read(val);
         return val;
     }
}

void main() {
     byte[] read = [0, 2, 4, 6, 8, 10, 12];
     auto t = new Test(read);
     byte val = t.read();
     t.write(1);
     byte val1 = t.m_stream.data;
     writeln(val, val1);
}


since memorystream is deprecated how do i do something like this 
with Input and Output ranges? How can i fill up an array with 
ranges like you can do with streams?
Thanks.


More information about the Digitalmars-d-learn mailing list