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
Thanks, your post was very helpful. Two more questions (probably
related):
Where is the function 'format' defined? Also, what is that 'unittest'
block? It compiles fine as is, but if I refer to format outside of
unittest, it will not compile. Also, if I compile and run your
example, it
scottrick:
Where is the function 'format' defined?
You need to add at the top of the module:
import std.conv: format;
Or:
import std.conv;
Also, what is that 'unittest' block? It compiles fine as is, but if I refer
to format outside of
unittest, it will not compile. Also, if I compile
Am 06.02.2011 19:38, schrieb Jesse Phillips:
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
On 02/05/2011 06:26 PM, scottrick wrote:
Hi,
I am new to D. I am trying to write a binary file parser for a
project of mine and I thought it would be fun to try and learn a new
language at the same time. So I chose D! :D I have been
struggling however and have not been able to find very
spir:
Out[] map (In, Out) (In[] source, Out delegate (In) f) {
// (0)
...
string hex (uint i) { return format(0x%03X, i); }
uint[] decs = [1, 3, 9, 27, 81, 243, 729];
auto hexes = map!(uint,string)(decs, hex);
...
(0) The func must be declared as delegate (instead of