 |
Changeset 3151
- Timestamp:
- 01/31/08 21:55:47
(10 months ago)
- Author:
- sean
- Message:
Added comments explaining the reasoning behind the apparently inconsistent naming scheme in this module. This closes #601
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3116 |
r3151 |
|
| 1 | 1 | /** |
|---|
| 2 | | * The traits module defines tools useful for obtaining detailed type |
|---|
| 3 | | * information at compile-time. |
|---|
| | 2 | * The traits module defines tools useful for obtaining detailed compile-time |
|---|
| | 3 | * information about a type. Please note that the mixed naming scheme used in |
|---|
| | 4 | * this module is intentional. Templates which evaluate to a type follow the |
|---|
| | 5 | * naming convention used for types, and templates which evaluate to a value |
|---|
| | 6 | * follow the naming convention used for functions. |
|---|
| 4 | 7 | * |
|---|
| 5 | 8 | * Copyright: Copyright (C) 2005-2006 Sean Kelly. All rights reserved. |
|---|
| … | … | |
| 11 | 14 | |
|---|
| 12 | 15 | /** |
|---|
| 13 | | * |
|---|
| | 16 | * Evaluates to true if T is char, wchar, or dchar. |
|---|
| 14 | 17 | */ |
|---|
| 15 | 18 | template isCharType( T ) |
|---|
| … | … | |
| 22 | 25 | |
|---|
| 23 | 26 | /** |
|---|
| 24 | | * |
|---|
| | 27 | * Evaluates to true if T is a signed integer type. |
|---|
| 25 | 28 | */ |
|---|
| 26 | 29 | template isSignedIntegerType( T ) |
|---|
| … | … | |
| 35 | 38 | |
|---|
| 36 | 39 | /** |
|---|
| 37 | | * |
|---|
| | 40 | * Evaluates to true if T is an unsigned integer type. |
|---|
| 38 | 41 | */ |
|---|
| 39 | 42 | template isUnsignedIntegerType( T ) |
|---|
| … | … | |
| 48 | 51 | |
|---|
| 49 | 52 | /** |
|---|
| 50 | | * |
|---|
| | 53 | * Evaluates to true if T is a signed or unsigned integer type. |
|---|
| 51 | 54 | */ |
|---|
| 52 | 55 | template isIntegerType( T ) |
|---|
| … | … | |
| 58 | 61 | |
|---|
| 59 | 62 | /** |
|---|
| 60 | | * |
|---|
| | 63 | * Evaluates to true if T is a real floating-point type. |
|---|
| 61 | 64 | */ |
|---|
| 62 | 65 | template isRealType( T ) |
|---|
| … | … | |
| 69 | 72 | |
|---|
| 70 | 73 | /** |
|---|
| 71 | | * |
|---|
| | 74 | * Evaluates to true if T is a complex floating-point type. |
|---|
| 72 | 75 | */ |
|---|
| 73 | 76 | template isComplexType( T ) |
|---|
| … | … | |
| 80 | 83 | |
|---|
| 81 | 84 | /** |
|---|
| 82 | | * |
|---|
| | 85 | * Evaluates to true if T is an imaginary floating-point type. |
|---|
| 83 | 86 | */ |
|---|
| 84 | 87 | template isImaginaryType( T ) |
|---|
| … | … | |
| 91 | 94 | |
|---|
| 92 | 95 | /** |
|---|
| 93 | | * |
|---|
| | 96 | * Evaluates to true if T is any floating-point type: real, complex, or |
|---|
| | 97 | * imaginary. |
|---|
| 94 | 98 | */ |
|---|
| 95 | 99 | template isFloatingPointType( T ) |
|---|
| … | … | |
| 102 | 106 | |
|---|
| 103 | 107 | /** |
|---|
| 104 | | * |
|---|
| | 108 | * Evaluates to true if T is a pointer type. |
|---|
| 105 | 109 | */ |
|---|
| 106 | 110 | template isPointerType( T ) |
|---|
| … | … | |
| 111 | 115 | |
|---|
| 112 | 116 | /** |
|---|
| 113 | | * |
|---|
| | 117 | * Evaluates to true if T is a a pointer, class, interface, or delegate. |
|---|
| 114 | 118 | */ |
|---|
| 115 | 119 | template isReferenceType( T ) |
|---|
| … | … | |
| 124 | 128 | |
|---|
| 125 | 129 | /** |
|---|
| 126 | | * |
|---|
| | 130 | * Evaulates to true if T is a dynamic array type. |
|---|
| 127 | 131 | */ |
|---|
| 128 | 132 | template isDynamicArrayType( T ) |
|---|
| … | … | |
| 133 | 137 | |
|---|
| 134 | 138 | /** |
|---|
| 135 | | * |
|---|
| | 139 | * Evaluates to true if T is a static array type. |
|---|
| 136 | 140 | */ |
|---|
| 137 | 141 | template isStaticArrayType( T ) |
|---|
| … | … | |
| 142 | 146 | |
|---|
| 143 | 147 | /** |
|---|
| 144 | | * |
|---|
| | 148 | * Evaluates to true if T is an associative array type. |
|---|
| 145 | 149 | */ |
|---|
| 146 | 150 | private template isAssocArrayType( T ) |
|---|
| … | … | |
| 151 | 155 | |
|---|
| 152 | 156 | /** |
|---|
| 153 | | * |
|---|
| | 157 | * Evaluates to true if T is a function, function pointer, delegate, or |
|---|
| | 158 | * callable object. |
|---|
| 154 | 159 | */ |
|---|
| 155 | 160 | template isCallableType( T ) |
|---|
| … | … | |
| 163 | 168 | |
|---|
| 164 | 169 | /** |
|---|
| 165 | | * |
|---|
| | 170 | * Evaluates to the return type of Fn. Fn is required to be a callable type. |
|---|
| 166 | 171 | */ |
|---|
| 167 | 172 | template ReturnTypeOf( Fn ) |
|---|
| … | … | |
| 175 | 180 | |
|---|
| 176 | 181 | /** |
|---|
| 177 | | * |
|---|
| | 182 | * Evaluates to the return type of fn. fn is required to be callable. |
|---|
| 178 | 183 | */ |
|---|
| 179 | 184 | template ReturnTypeOf( alias fn ) |
|---|
| … | … | |
| 187 | 192 | |
|---|
| 188 | 193 | /** |
|---|
| 189 | | * |
|---|
| | 194 | * Evaluates to a tuple representing the parameters of Fn. Fn is required to |
|---|
| | 195 | * be a callable type. |
|---|
| 190 | 196 | */ |
|---|
| 191 | 197 | template ParameterTupleOf( Fn ) |
|---|
| … | … | |
| 203 | 209 | |
|---|
| 204 | 210 | /** |
|---|
| 205 | | * |
|---|
| | 211 | * Evaluates to a tuple representing the parameters of fn. n is required to |
|---|
| | 212 | * be callable. |
|---|
| 206 | 213 | */ |
|---|
| 207 | 214 | template ParameterTupleOf( alias fn ) |
|---|
| … | … | |
| 215 | 222 | |
|---|
| 216 | 223 | /** |
|---|
| 217 | | * |
|---|
| | 224 | * Evaluates to a tuple representing the ancestors of T. T is required to be |
|---|
| | 225 | * a class or interface type. |
|---|
| 218 | 226 | */ |
|---|
| 219 | 227 | template BaseTypeTupleOf( T ) |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic