On Wednesday, 24 February 2016 at 21:48:14 UTC, mahdi wrote:
Suppose we have a function like this:

void diss(int[] array) ...

How can we detect is `array` is static (fixed size) or dynamic, inside the function body?

I don't understand what I'm doing but got a proof of concept for you. This https://dlang.org/phobos/std_traits.html page helped.

import std.stdio;

void main() {
    int[]  a;
    int[1] b;
    writeln(is(typeof(a) == int[])); // true
    writeln(is(typeof(b) == int[])); // false
}

Reply via email to