Skip to content

Commit 064bf4b

Browse files
committed
specify Unsigned, Integral, Floating, Arithmetic and Scalar Types
1 parent 71522a6 commit 064bf4b

File tree

2 files changed

+76
-13
lines changed

2 files changed

+76
-13
lines changed

spec/traits.dd

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ $(GNAME TraitsArgument):
7979

8080
$(H2 $(GNAME isArithmetic))
8181

82-
$(P If the arguments are all either types that are arithmetic types,
82+
$(P If the arguments are all either types that are $(DDSUBLINK type, Arithmetic Type, $(I Arithmetic Type)),
8383
or expressions that are typed as arithmetic types, then $(D true)
8484
is returned.
8585
Otherwise, $(D false) is returned.
@@ -111,8 +111,7 @@ false
111111

112112
$(H2 $(GNAME isFloating))
113113

114-
$(P Works like $(D isArithmetic), except it's for floating
115-
point types (including imaginary and complex types).)
114+
$(P Works like $(GLINK isArithmetic), except it's for $(DDSUBLINK type, Floating Type, $(I Floating Type)).)
116115

117116
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
118117
---
@@ -132,8 +131,7 @@ static assert(!__traits(isFloating, float[4]));
132131

133132
$(H2 $(GNAME isIntegral))
134133

135-
$(P Works like $(D isArithmetic), except it's for integral
136-
types (including character types).)
134+
$(P Works like $(GLINK isArithmetic), except it's for $(DDSUBLINK type, Integral Type, $(I Integral Type)).)
137135

138136
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
139137
---
@@ -155,8 +153,7 @@ static assert(!__traits(isIntegral, void*));
155153

156154
$(H2 $(GNAME isScalar))
157155

158-
$(P Works like $(D isArithmetic), except it's for scalar
159-
types.)
156+
$(P Works like $(GLINK isArithmetic), except it's for $(DDSUBLINK type, Scalar Type, $(I Scalar Type)).)
160157

161158
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
162159
---
@@ -182,8 +179,7 @@ static assert(!__traits(isScalar, Object));
182179

183180
$(H2 $(GNAME isUnsigned))
184181

185-
$(P Works like $(D isArithmetic), except it's for unsigned
186-
types.)
182+
$(P Works like $(GLINK isArithmetic), except it's for $(DDSUBLINK type, Unsigned Type, $(I Unsigned Type)).)
187183

188184
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
189185
---
@@ -208,7 +204,7 @@ static assert(!__traits(isUnsigned, void*));
208204

209205
$(H2 $(GNAME isStaticArray))
210206

211-
$(P Works like $(D isArithmetic), except it's for static array
207+
$(P Works like $(GLINK isArithmetic), except it's for static array
212208
types.)
213209

214210
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
@@ -228,7 +224,7 @@ static assert(!__traits(isStaticArray, array));
228224

229225
$(H2 $(GNAME isAssociativeArray))
230226

231-
$(P Works like $(D isArithmetic), except it's for associative array
227+
$(P Works like $(GLINK isArithmetic), except it's for associative array
232228
types.)
233229

234230
$(H2 $(GNAME isAbstractClass))

spec/type.dd

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ $(H2 $(LEGACY_LNAME2 Derived Data Types, derived-data-types, Derived Data Types)
4747

4848
$(UL
4949
$(LI pointer)
50-
$(LI array)
50+
$(LI static array)
51+
$(LI dynamic array)
5152
$(LI associative array)
5253
$(LI function)
5354
$(LI delegate)
55+
$(LI vector)
5456
)
5557

5658
$(P $(DDSUBLINK spec/arrays, strings, $(I Strings)) are a special case of arrays.)
@@ -62,7 +64,7 @@ $(H2 $(LEGACY_LNAME2 User Defined Types, user-defined-types, User-Defined Types)
6264
$(LI struct)
6365
$(LI union)
6466
$(LI class)
65-
67+
$(LI interface)
6668
)
6769

6870
$(H2 $(LEGACY_LNAME2 Base Types, base-types, Base Types))
@@ -73,6 +75,71 @@ $(H2 $(LEGACY_LNAME2 Base Types, base-types, Base Types))
7375
enum E : T { ... } // T is the base type of E
7476
---
7577

78+
$(H2 $(LNAME2 Unsigned Type, Unsigned Type))
79+
80+
$(P The following are $(I Unsigned Type):)
81+
82+
$(UL
83+
$(LI bool)
84+
$(LI ubyte) $(LI ushort) $(LI uint) $(LI ulong) $(LI ucent)
85+
$(LI char) $(LI wchar) $(LI dchar)
86+
)
87+
88+
$(P If the $(GLINK2 enum, EnumBaseType) of an enum is an $(I Unsigned Type), the enum
89+
is an $(I Unsigned Type).)
90+
91+
$(P If the element type of a vector is an $(I Unsigned Type), the vector
92+
is an $(I Unsigned Type).)
93+
94+
$(H2 $(LNAME2 Integral Type, Integral Type))
95+
96+
$(P The following are $(I Integral Type):)
97+
98+
$(UL
99+
$(LI $(DDSUBLINK type, Unsigned Type, $(I Unsigned Type)))
100+
$(LI byte) $(LI short) $(LI int) $(LI long) $(LI cent)
101+
)
102+
103+
$(P If the $(GLINK2 enum, EnumBaseType) of an enum is an $(I Integral Type), the enum
104+
is an $(I Integral Type).)
105+
106+
$(P If the element type of a vector is an $(I Integral Type), the vector
107+
is an $(I Integral Type).)
108+
109+
$(H2 $(LNAME2 Floating Type, Floating Type))
110+
111+
$(P The following are $(I Floating Type):)
112+
113+
$(UL
114+
$(LI float) $(LI double) $(LI real)
115+
$(LI ifloat) $(LI idouble) $(LI ireal)
116+
$(LI cfloat) $(LI cdouble) $(LI creal)
117+
)
118+
119+
$(P If the $(GLINK2 enum, EnumBaseType) of an enum is a $(I Floating Type), the enum
120+
is a $(I Floating Type).)
121+
122+
$(P If the element type of a vector is a $(I Floating Type), the vector
123+
is a $(I Floating Type).)
124+
125+
$(H2 $(LNAME2 Arithmetic Type, Arithmetic Type))
126+
127+
$(P The following are $(I Arithmetic Type):)
128+
129+
$(UL
130+
$(LI $(DDSUBLINK type, Integral Type, $(I Integral Type)))
131+
$(LI $(DDSUBLINK type, Floating Type, $(I Floating Type)))
132+
)
133+
134+
$(H2 $(LNAME2 Scalar Type, Scalar Type))
135+
136+
$(P The following are $(I Scalar Type):)
137+
138+
$(UL
139+
$(LI $(DDSUBLINK type, Arithmetic Type, $(I Arithmetic Type)))
140+
$(LI $(I Pointer))
141+
)
142+
76143
$(H2 $(LEGACY_LNAME2 Pointer Conversions, pointer-conversions, Pointer Conversions))
77144

78145
$(P Casting pointers to non-pointers and vice versa is allowed.)

0 commit comments

Comments
 (0)