Re: Help with specific template function

2018-03-26 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 26 March 2018 at 06:48:45 UTC, rumbu wrote: isNumeric applies to a type, not to a variable => IsNumeric!X On Monday, 26 March 2018 at 06:51:48 UTC, arturg wrote: use the type not the variables: isNumeric!X && isNumeric!Y Ah, missed that. Thanks a bunch!

Re: Help with specific template function

2018-03-26 Thread arturg via Digitalmars-d-learn
On Monday, 26 March 2018 at 06:40:34 UTC, Vladimirs Nordholm wrote: How would I resolve this issue? use the type not the variables: isNumeric!X && isNumeric!Y

Re: Help with specific template function

2018-03-26 Thread rumbu via Digitalmars-d-learn
On Monday, 26 March 2018 at 06:40:34 UTC, Vladimirs Nordholm wrote: However I do not understand how to use that with my arguments. Eg. I would expect to do something like: void foo(X, Y, Args...)(X x, Y y, Args args) if(isNumeric!(x) && isNumeric!(y) && args.length >= 1) {

Re: Help with specific template function

2018-03-26 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Sunday, 25 March 2018 at 21:31:16 UTC, aliak wrote: On Sunday, 25 March 2018 at 19:06:14 UTC, Vladimirs Nordholm wrote: On Sunday, 25 March 2018 at 18:24:37 UTC, Vladimirs Nordholm wrote: The underlying problems are: * How do I ensure the two first arguments (used as coordinates) are types

Re: Help with specific template function

2018-03-25 Thread aliak via Digitalmars-d-learn
On Sunday, 25 March 2018 at 19:06:14 UTC, Vladimirs Nordholm wrote: On Sunday, 25 March 2018 at 18:24:37 UTC, Vladimirs Nordholm wrote: The underlying problems are: * How do I ensure the two first arguments (used as coordinates) are types of numbers (all kinds: ints, floats, reals, etc.) *

Re: Help with specific template function

2018-03-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Sunday, 25 March 2018 at 18:24:37 UTC, Vladimirs Nordholm wrote: The underlying problems are: * How do I ensure the two first arguments (used as coordinates) are types of numbers (all kinds: ints, floats, reals, etc.) * At least one argument is passed after the coordinates I found a

Help with specific template function

2018-03-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello Dlang community! I need help in creating a template function which would look like the following pseudo-code: void foo(, , , ...); // would be used as `void foo(x, y, arg1, arg2, ..., argN)` // valid examples: foo(5.332, 1, "a string", 123, "42"); foo(3, 44,