Is this a bug? "ref" affects only first tuple element
Henning Hasemann
hhasemann at web.de
Fri Aug 10 09:47:38 PDT 2007
FYI: I found a workaround. It goes like this:
import std.traits;
/**
* Given the types T create a delegate with return type int and
* parameter
* types ref T.
* Example:
*
* TupleDelegate!(int, char[], void*) dg;
*
* is equivalent to:
*
* int delegate(ref int, ref char[], ref void*) dg;
*/
template TupleDelegate(T ...) {
alias MkDelegate!(int delegate(), T) TupleDelegate;
}
/**
* Helper for TupleDelegate.
* Parameters:
* D: accumulated delegate
* A, B: Types to append to D's parameter list
*/
template MkDelegate(D, A, B ...) {
alias MkDelegate!(int delegate(ParameterTypeTuple!(D), ref A), B) MkDelegate;
}
/**
* Ditto
*/
template MkDelegate(D, A) {
alias int delegate(ParameterTypeTuple!(D), ref A) MkDelegate;
}
--
GPG Public Key:
http://keyserver.ganneff.de:11371/pks/lookup?op=get&search=0xDDD6D36D41911851
Fingerprint: 344F 4072 F038 BB9E B35D E6AB DDD6 D36D 4191 1851
More information about the Digitalmars-d
mailing list