On Wednesday, 6 July 2016 at 19:50:11 UTC, pineapple wrote:
I'd like to do something like this but it doesn't seem to be legal -

    void test(int[] ints...) if(ints.length){
        // stuff
    }

Not being able to specify this interferes with how I'd like to define my method overloads. What's the best way to achieve what I'm looking for?

I don't really know what you're looking for. But you need to drop the if condition - you can only specify them for templates as instantiation constraints. You may want to use a runtime check instead (the slice's size isn't available at compile-time - although it's known at the call site):

void test(int[] ints...] { assert(ints); ... }

Reply via email to