How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is there a way to do that with only one template argument. And then use it like: string text = null; mixin

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is there a way to do that with only one template argument. And

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Tobias Pankrath
On Friday, 2 August 2013 at 11:50:05 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is there a

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 11:48:32 UTC, Andrej Mitrovic wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null) throw new Exception(name~ cannot be null.); } But is

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 12:10:00 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:52:32 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template ArgNull(alias arg, string name) { if(arg is null)

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread monarch_dodra
On Friday, 2 August 2013 at 12:17:12 UTC, Bosak wrote: On Friday, 2 August 2013 at 12:10:00 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:52:32 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I want to create a mixin template such that: mixin template

Re: How to create mixin template and pass name of a variable?

2013-08-02 Thread Bosak
On Friday, 2 August 2013 at 12:47:51 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 12:17:12 UTC, Bosak wrote: On Friday, 2 August 2013 at 12:10:00 UTC, Bosak wrote: On Friday, 2 August 2013 at 11:52:32 UTC, monarch_dodra wrote: On Friday, 2 August 2013 at 11:37:27 UTC, Bosak wrote: I