Mercurial > projects > orange
comparison orange/util/Traits.d @ 27:fc315d786f24 experimental
Added unit testing.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 19 Nov 2010 11:14:55 +0100 |
parents | 78e5fef4bbf2 |
children | 301476d40518 |
comparison
equal
deleted
inserted
replaced
26:78e5fef4bbf2 | 27:fc315d786f24 |
---|---|
25 alias Phobos.ParameterTypeTuple ParameterTupleOf; | 25 alias Phobos.ParameterTypeTuple ParameterTupleOf; |
26 alias Phobos.ReturnType ReturnTypeOf; | 26 alias Phobos.ReturnType ReturnTypeOf; |
27 | 27 |
28 version = Phobos; | 28 version = Phobos; |
29 } | 29 } |
30 | |
31 import orange.core.string; | |
30 | 32 |
31 template isPrimitive (T) | 33 template isPrimitive (T) |
32 { | 34 { |
33 const bool isPrimitive = is(T == bool) || | 35 const bool isPrimitive = is(T == bool) || |
34 is(T == byte) || | 36 is(T == byte) || |
89 const bool isArray = false; | 91 const bool isArray = false; |
90 } | 92 } |
91 | 93 |
92 template isString (T) | 94 template isString (T) |
93 { | 95 { |
94 const bool isString = is(T : char[]) || is(T : wchar[]) || is(T : dchar[]); | 96 const bool isString = is(T : string) || is(T : wstring) || is(T : dstring); |
95 } | 97 } |
96 | 98 |
97 template isAssociativeArray (T) | 99 template isAssociativeArray (T) |
98 { | 100 { |
99 const bool isAssociativeArray = is(typeof(T.init.values[0])[typeof(T.init.keys[0])] == T); | 101 const bool isAssociativeArray = is(typeof(T.init.values[0])[typeof(T.init.keys[0])] == T); |