Mercurial > projects > ldc
diff lphobos/std/traits.d @ 473:373489eeaf90
Applied downs' lphobos update
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 04 Aug 2008 19:28:49 +0200 |
parents | 61615fa85940 |
children |
line wrap: on
line diff
--- a/lphobos/std/traits.d Mon Aug 04 19:08:39 2008 +0200 +++ b/lphobos/std/traits.d Mon Aug 04 19:28:49 2008 +0200 @@ -127,37 +127,14 @@ assert(is (TL[1] == I)); } -/* ******************************************* - */ -template isStaticArray_impl(T) -{ - const T inst = void; - - static if (is(typeof(T.length))) - { - static if (!is(typeof(T) == typeof(T.init))) - { // abuses the fact that int[5].init == int - static if (is(T == typeof(T[0])[inst.length])) - { // sanity check. this check alone isn't enough because dmd complains about dynamic arrays - const bool res = true; - } - else - const bool res = false; - } - else - const bool res = false; - } - else - { - const bool res = false; - } -} /** * Detect whether type T is a static array. */ template isStaticArray(T) { - const bool isStaticArray = isStaticArray_impl!(T).res; + static if (isArray!(T)) + const bool isStaticArray = !is(T == typeof(T[0])[]); + else const bool isStaticArray = false; }