On Thursday, 26 March 2015 at 10:07:07 UTC, Hugo wrote:
If only the documentation and/or test units were more clear...
OK, I made a simpler test, using an example from the
documentation:
void main() {
import std.stdio, std.array, std.bitmanip;
auto buffer = appender!(const ubyte[])();
buffer.append!ushort(261);
assert(buffer.data == [1, 5]);
writefln("%s", buffer.data);
}
It seems to work, so apparently one has to explicitly create a
buffer with the appender template. Not terribly useful IMHO.
Wouldn't it be possible for the append function to automaticaly
change the mode of an already existing buffer?
Also, can anyone provide a similar example but using little
endian order? If only to contrast differences between modes of
invocation...