status of "isComplex" in traits ?? (we have isFloatingPoint, for example)
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Aug 18 17:36:48 UTC 2021
On Wed, Aug 18, 2021 at 05:22:31PM +0000, james.p.leblanc via Digitalmars-d wrote:
> Dear All,
>
> We indeed have **"isFloatingPoint"**, and **"isIntegral"** in
> std.traits.
>
> But, what is the status/thinking about having **"isComplex"** included
> in std.traits (... or ... potentially std.complex ??).
>
> I ask because, there are recommendations that we should start using
> Complex!double, Complex!float ... so perhaps this is a good time for a
> formal home for "isComplex" ??
There's no need, you could just write:
static if (is(T == Complex!U, U)) {
// You can refer to U here to get at the type Complex
// was instantiated with.
}
This has the added benefit of unpacking the parameter U for you.
T
--
Never trust an operating system you don't have source for! -- Martin Schulze
More information about the Digitalmars-d
mailing list