how to pass multiple arguments via a mixin

Timothee Cour thelastmammoth at gmail.com
Tue Oct 15 18:59:49 PDT 2013


doesn't work with ref args:

void fun(ref int a,ref int b){
  a=1;
}
void main(){
  int a,b;
  import std.typecons;
  fun(mixin("tuple(a,b).expand"));
  assert(a==1);//fails
}


and we can't do a logic such as: if there's ref args use Alias, otherwise
use tuple().expand because there could be a mix of the two



On Tue, Oct 15, 2013 at 5:56 PM, Dicebot <public at dicebot.lv> wrote:

> On Wednesday, 16 October 2013 at 00:36:46 UTC, Timothee Cour wrote:
>
>> ...
>>
>
> Have you tried run-time tuple?
>
> ```
> import std.typecons;
> writeln(mixin("tuple(&a,&b).**expand"));
> ```
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131015/ac05066f/attachment.html>


More information about the Digitalmars-d-learn mailing list