Understand signature of opOpAssign in std/complex.d
René Heldmaier
rene.heldmaier at gmail.com
Sat Nov 9 12:30:46 UTC 2019
Hi,
i'm currently implementing a dual number datatype. Dual numbers
are very similar to complex numbers, but instead i (i^2 = -1) you
have epsilon (epsilon^2 = 0).
This sounds strange but it is really useful for something called
"automatic derivation". I will probably explain it in more detail
when i'm ready to publish it as a dub package...
Because of the similarity to complex numbers i looked at how they
are implemented in std/complex.d, to learn from how it is done
there.
I came across a function signature which i don't understand:
ref Complex opOpAssign(string op, C)(const C z)
if ((op == "+" || op == "-") && is(C R == Complex!R))
The part i don't understand is "is(C R == Complex!R)".
What does that mean?
More information about the Digitalmars-d-learn
mailing list