[Issue 8167] New: BigInt(BigInt(1)) too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 30 05:14:08 PDT 2012


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

           Summary: BigInt(BigInt(1)) too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-05-30 05:15:59 PDT ---
I think there's no need to refuse this code:

import std.bigint: BigInt;
void main() {
    auto b1 = BigInt(1);
    auto b2 = BigInt(b1);
}


DMD 2.060alpha gives:

test.d(4): Error: template std.bigint.BigInt.__ctor does not match any function
template declaration
...\dmd2\src\phobos\std\bigint.d(82): Error: template std.bigint.BigInt.__ctor
cannot deduce template function from argument types !()(BigInt)


Currently BigInt contains immutable digits, so that operation is O(1).
GMP supports mutable numbers too for higher efficiency for certain operations,
if BigInt will do the same, then BigInt(BigInt(1)) will create a copy of the
digits.

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