Help with specific template function
Vladimirs Nordholm
v at vladde.net
Sun Mar 25 18:24:37 UTC 2018
Hello Dlang community!
I need help in creating a template function which would look like
the following pseudo-code:
void foo(<a number>, <also a number>, <required arg>,
<optional arg>...);
// would be used as `void foo(x, y, arg1, arg2, ..., argN)`
// valid examples:
foo(5.332, 1, "a string", 123, "42");
foo(3, 44, false);
// invalid examples:
foo(1, 1);
foo(3, "stringers", "arg");
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
Best regards,
Vladimris Nordholm
More information about the Digitalmars-d-learn
mailing list