On 08/08/2012 09:11 PM, Johannes Pfau wrote:
Am Wed, 08 Aug 2012 18:53:05 +0200
schrieb Timon Gehr<timon.g...@gmx.ch>:

Try this:

template digest(Hash) if(isDigest!Hash){
        digestType!Hash digest(Range)(Range data)
if(!is(Range:void[][])&&  isInputRange!Range&&
__traits(compiles,digest!Hash(ElementType!(Range).init))){
                //implementation detail
        }
        digestType!Hash digest()(scope const(void[])[] data...){ //
templated as a workaround
                //implementation detail
        }
          // ... (maybe more overloads)
}

Clever, but doesn't seem to work.  I can't create an instance of it, even
when explicitly specifying the types.


Well, I have done similar things in the past. The general concept should work.

BTW: This is a working version, but it does cause template bloat:
http://dpaste.dzfl.pl/d42a58aa


Maybe this helps:
http://dpaste.dzfl.pl/ed2e8e5d

Reply via email to