std.complex

Lars T. Kyllingstad public at kyllingen.net
Thu Jan 2 01:13:49 PST 2014


On Thursday, 2 January 2014 at 02:59:05 UTC, Andrei Alexandrescu
wrote:
> On 1/1/14 3:12 PM, Lars T. Kyllingstad wrote:
>> Currently Complex!(Complex!T)
>> folds to Complex!T.
>
> What was the motivation?

To simplify generic code, where you have a function that takes
both real and complex arguments and returns a complex number,
e.g.:

    Complex!T fun(T)(T x) {
        return x * someComplexNumber;
    }

In the above, T may be real or complex.


More information about the Digitalmars-d mailing list