Changeset 3690
- Timestamp:
- 06/30/08 06:56:36 (4 months ago)
- Files:
-
- trunk/tango/core/Traits.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tango/core/Traits.d
r3453 r3690 108 108 * Evaluates to true if T is a pointer type. 109 109 */ 110 template isPointerType( T ) 111 { 112 const bool isPointerType = is( typeof(*T) ); 113 } 114 110 template isPointerType(T) 111 { 112 const isPointerType = false; 113 } 114 115 template isPointerType(T : T*) 116 { 117 const isPointerType = true; 118 } 119 120 debug(UnitTest) { 121 122 unittest { 123 124 assert(isPointerType!(void*)); 125 assert(!isPointerType!(char[])); 126 assert(isPointerType!(char[]*)); 127 assert(!isPointerType!(char*[])); 128 assert(isPointerType!(real*)); 129 assert(!isPointerType!(uint)); 130 131 class Ham 132 { 133 void* a; 134 } 135 136 assert(!isPointerType!(Ham)); 137 138 union Eggs 139 { 140 void* a; 141 uint b; 142 }; 143 144 assert(!isPointerType!(Eggs)); 145 assert(isPointerType!(Eggs*)); 146 147 struct Bacon {}; 148 149 assert(!isPointerType!(Bacon)); 150 151 } 152 } 115 153 116 154 /**












