problems with std.bitmanip.append

Hugo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 25 08:44:49 PDT 2015


Hi,

I need to append an uint as an array of ubytes (in little endian) 
to an existing array of ubytes. I tried to compile this code 
(with dmd 2.066.1 under Windows 7 x86-64):

void main() {
    ubyte[] buffer = [0x1f, 0x8b, 0x08, 0x00];
    import std.system;
    import std.datetime : Clock, stdTimeToUnixTime;
    import std.bitmanip : append;
    
buffer.append!ubyte(cast(uint)stdTimeToUnixTime(Clock.currStdTime), 
Endian.littleEndian);
}

But it gives me this error: template std.bitmanip.append cannot 
deduce function from argument types !(ubyte)(ubyte[], uint, 
Endian)

Supposedly append "Takes an integral value, converts it to the 
given endianness, and appends it to the given range of ubytes 
(using put) as a sequence of T.sizeof ubytes", so I thought I 
could use it, but after reading the documentation page for the 
function and the examples, I honestly can't understand where is 
the problem is.

Please, help!

Regards, Hugo


More information about the Digitalmars-d-learn mailing list