std.Stream.InputStream convenience functions

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 3 17:05:04 PDT 2015


Thoughts?

private T readAndReturn(T)(InputStream stream)
{
     T ret;
     stream.read(ret);
     return ret;
}

alias readByte    = readAndReturn!byte;
alias readUByte   = readAndReturn!ubyte;
alias readShort   = readAndReturn!short;
alias readUShort  = readAndReturn!ushort;
alias readInt     = readAndReturn!int;
alias readUInt    = readAndReturn!uint;
alias readLong    = readAndReturn!long;
alias readULong   = readAndReturn!ulong;
alias readFloat   = readAndReturn!float;
alias readDouble  = readAndReturn!double;
alias readReal    = readAndReturn!real;
alias readIfloat  = readAndReturn!ifloat;
alias readIdouble = readAndReturn!idouble;
alias readIreal   = readAndReturn!ireal;
alias readCfloat  = readAndReturn!cfloat;
alias readCdouble = readAndReturn!cdouble;
alias readCreal   = readAndReturn!creal;
alias readChar    = readAndReturn!char;
alias readWchar   = readAndReturn!wchar;
alias readDchar   = readAndReturn!dchar;


More information about the Digitalmars-d mailing list