overloading a function taking a void[][]

Johannes Pfau nospam at example.com
Wed Aug 8 12:11:44 PDT 2012


Am Wed, 08 Aug 2012 18:53:05 +0200
schrieb Timon Gehr <timon.gehr at 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.

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



More information about the Digitalmars-d-learn mailing list