Build Hash from Array in one statement ?

Ali Çehreli acehreli at yahoo.com
Sat Feb 22 12:49:55 PST 2014


On 02/22/2014 11:26 AM, Gordon wrote:

 > Is there a way to quickly build a hash from the values of an array?

If I am allowed to misunderstand :) it as a *single* hash from all of 
the values, then you can use D's internal hash algorithm for arrays:

import std.stdio;

void main()
{
     auto arr = [ 1, 2, 3 ];
     writeln(typeid(arr).getHash(&arr));
}

Ali



More information about the Digitalmars-d-learn mailing list