Am Wed, 8 Aug 2012 17:50:33 +0200
schrieb Johannes Pfau <nos...@example.com>:

> However, I do agree digest!Hash, md5Of, sha1Of should have an
> additional overload which takes a InputRange. It would be implemented
> with copy and be a nice convenience function.

I implemented the function, it's actually quite simple:
----
digestType!Hash digestRange(Hash, Range)(Range data) if(isDigest!Hash &&
    isInputRange!Range && __traits(compiles,
    digest!Hash(ElementType!(Range).init)))
{
    Hash hash;
    hash.start();
    copy(data, hash);
    return hash.finish();
}
----

but I don't know how make it an overload. See thread "overloading a
function taking a void[][]" in D.learn for details.

Reply via email to