[Issue 11188] std.math.abs fails for shared, const or immutable BigInt types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 10 11:20:09 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11188


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh at quickfur.ath.cx


--- Comment #1 from hsteoh at quickfur.ath.cx 2013-10-10 11:20:06 PDT ---
Does std.math.abs even work for anything other than built-in types currently? I
know it should, but I'm skeptical if it does.

In any case, it should take inout arguments since it doesn't (and shouldn't)
modify them. So this (in theory) should work:

inout(Num) abs(Num)(inout(Num) x) if ( ... ) {
    return (x >= 0) ? x : -x;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list