New to D: parse a binary file

Jesse Phillips jessekphillips+D at gmail.com
Sun Feb 6 10:38:31 PST 2011


scottrick Wrote:

> T[] rawRead(T)(T[] buffer);
> 
> I understand that T is generic type, but I am not sure of the
> meaning of the (T) after the method name.

That T is defining the symbol to represent the generic type. It can have more than one and D provides other things like aliases... Another way to write that function (I may get something wrong here but give it a shot) is:

template(T) {
    T[] rawRead(T[] buffer);
}


More information about the Digitalmars-d-learn mailing list