Steven,
I see, but here's IsStaticArray from traits.d
template isStaticArray(T : U[N], U, size_t N)
{
enum bool isStaticArray = true;
}
template isStaticArray(T)
{
enum bool isStaticArray = false;
}
It looks like the first version is using the "[]" format. It is different
in that it has the [N] and then goes on to specify that N is a size_t.
John
On Mon, Oct 31, 2011 at 5:13 AM, Steven Schveighoffer
<[email protected]>wrote:
> On Sat, 29 Oct 2011 12:11:42 -0400, J Arrizza <[email protected]> wrote:
>
> Thanks for the reply Jonathan, but it didn't work for me:
>>
>> void abc(T) (T[] parm1)
>>
>> if (isDynamicArray!T)
>> {
>> writeln("array : ", parm1);
>> }
>>
>>
>> Nor did:
>>
>> void abc(T) (T[] parm1)
>>
>> if (isStaticArray!T)
>> {
>> writeln("array : ", parm1);
>> }
>>
>>
>> Output is the same:
>>
>> simpleparm: 1
>> simpleparm: str
>> simpleparm: [1, 2]
>>
>
> I know you've since figured it out, but I thought I'd point out why this
> didn't work.
>
> The reason it doesn't match is because your parameters are arrays of type
> T, but you are only instantiating if T *itself* is an array. So for
> example, int[][] would work, because T is matched as int[], giving int[][]
> as the parm1 type.
>
> -Steve
>
--
John
blog: http://arrizza.blogspot.com/
web: http://www.arrizza.com/