Re: Function accepting variadic arguments

2016-01-20 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 13:09:13 UTC, Daniel Kozak wrote: On Wednesday, 20 January 2016 at 13:06:14 UTC, pineapple wrote: On Wednesday, 20 January 2016 at 12:56:51 UTC, Ali Çehreli wrote: And there is another example here: http://ddili.org/ders/d.en/templates_more.html#ix_templates_m

Re: Function accepting variadic arguments

2016-01-20 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 13:06:14 UTC, pineapple wrote: On Wednesday, 20 January 2016 at 12:56:51 UTC, Ali Çehreli wrote: And there is another example here: http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.tuple%20template%20parameter Ali Thank you! What's the purpo

Re: Function accepting variadic arguments

2016-01-20 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 13:04:23 UTC, Daniel Kozak wrote: V Wed, 20 Jan 2016 12:38:20 + pineapple via Digitalmars-d-learn napsáno: import std.stdio; struct S { this(Args...)(Args args) { foreach(Type, Value;args) { writefln("Type: %s value: %

Re: Function accepting variadic arguments

2016-01-20 Thread pineapple via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 12:56:51 UTC, Ali Çehreli wrote: And there is another example here: http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.tuple%20template%20parameter Ali Thank you! What's the purpose of "is" in the type checks? Also, how would I utilize isNumer

Re: Function accepting variadic arguments

2016-01-20 Thread Daniel Kozak via Digitalmars-d-learn
V Wed, 20 Jan 2016 12:38:20 + pineapple via Digitalmars-d-learn napsáno: > I'd like to make a constructor which takes a variable list of > arguments, of a short list of possible types, with different > handling depending on the type. I haven't been able to find any > documentation or examp

Re: Function accepting variadic arguments

2016-01-20 Thread Ali Çehreli via Digitalmars-d-learn
On 01/20/2016 04:38 AM, pineapple wrote: I'd like to make a constructor which takes a variable list of arguments, of a short list of possible types, with different handling depending on the type. I haven't been able to find any documentation or examples that did quite what I'm trying to. Help? A

Function accepting variadic arguments

2016-01-20 Thread pineapple via Digitalmars-d-learn
I'd like to make a constructor which takes a variable list of arguments, of a short list of possible types, with different handling depending on the type. I haven't been able to find any documentation or examples that did quite what I'm trying to. Help? A fun pseudocode example of what I'm try