On Thu, May 21, 2009 at 8:00 PM, Fractal <happycod...@server.com> wrote: > Fractal Wrote: > >> Hello >> >> Any body can explan me how to determine if a template argument is an array? > > ...And also if is an associative array > >> Thanks >
You can also use template specialization, which, depending on your use case, might be shorter and clearer than a static if. template Foo(T: T[]) will specialize for dynamic array arguments. T will be the element type (so for int[], T will be int). template Foo(T: T[n], size_t n) will specialize for static array arguments. T will be the element type like above, and n will be the size of the array. template Foo(T: T[K], K) will specialize for associative array arguments. T will be the value type, and K will be the key type.