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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 3 13:25:23 PST 2013


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



--- Comment #8 from Simen Kjaeraas <simen.kjaras at gmail.com> 2013-11-03 13:25:17 PST ---
Adding this overload to std.math is a workaround for the problems with shared:

Num abs(Num)(shared Num x) @safe pure nothrow 
    if (is(typeof(abs(Num.init))) && is(typeof({Num n = x;})))
{
    Num tmp = x;
    return abs(tmp);
}


However, given that shared is currently rather ill-specified, and possibly will
change dramatically relatively soon (let's hope so), and that this is a
workaround for a single function only, I feel it's better to leave the
workaround out for the time being, and wait for a real solution.

-- 
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