Skip to content

Commit

Permalink
Add ddoc example for isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
JackStouffer committed Jun 2, 2016
1 parent b284e96 commit 380623d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions std/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -5433,20 +5433,28 @@ unittest
*/
enum bool isArray(T) = isStaticArray!T || isDynamicArray!T;

///
unittest
{
foreach (T; TypeTuple!(int[], int[5], void[]))
static assert( isArray!(int[]));
static assert( isArray!(int[5]));
static assert( isArray!(string));

static assert(!isArray!uint);
static assert(!isArray!(uint[uint]));
static assert(!isArray!(typeof(null)));
}

unittest
{
foreach (T; AliasSeq!(int[], int[5], void[]))
{
foreach (Q; TypeQualifierList)
{
static assert( isArray!(Q!T));
static assert(!isArray!(SubTypeOf!(Q!T)));
}
}

static assert(!isArray!uint);
static assert(!isArray!(uint[uint]));
static assert(!isArray!(typeof(null)));
}

/**
Expand Down

0 comments on commit 380623d

Please sign in to comment.