Assigning a static array

Brad Anderson eco at gnuk.net
Thu Apr 18 14:10:07 PDT 2013


For reference, here was what user soos on IRC was doing that 
caused him to hit this <http://dpaste.dzfl.pl/08ee7b76#>:

import std.digest.md;
import std.stdio;

struct Hash {
   ubyte[] hash1;
   ubyte[] hash2;

   this (string str) {
     auto md5 = new MD5Digest();
     this.hash1 = md5.digest(str);
     this.hash2 = digest!MD5(str);
   }
};

void main() {
   auto h = Hash("hello world!");
   writeln(toHexString(h.hash1));
   writeln(toHexString(h.hash2));
}


It's not obvious at all what the problem is.


More information about the Digitalmars-d-learn mailing list