On Friday, 20 November 2020 at 14:57:42 UTC, H. S. Teoh wrote:
On Fri, Nov 20, 2020 at 02:47:52PM +0000, Paul Backus via Digitalmars-d-learn wrote: [...]
In this specific case, you could also make `foo` a type-safe variadic function [1], which would eliminate the need for `allSatisfy`:

    void foo(double[] args...)
    {
        // ...
    }
[...]

Yes, and this will also eliminate the template bloat associated with .foo, which would have been instantiated once per call with a different number of arguments. But of course, this only works if all arguments are of the same type, and if the function body does not depend on accessing the number of arguments at compile-time.


T

Thanks all.

The template conditions I'm working on are complicated enough that this approach might work for some but not all. However, if I split out the function I'm working on into a separate one, then I might be able to take advantage of that.

Reply via email to