Issue 8480 - to!string(BigInt, base) doesn't work
Summary: to!string(BigInt, base) doesn't work
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-31 03:08 UTC by bearophile_hugs
Modified: 2024-12-01 16:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2012-07-31 03:08:41 UTC
import std.stdio: writeln;
import std.conv: to;
import std.bigint: BigInt;
void main() {
    int base = 6;
    int n1 = 588_225;
    string s1 = to!string(n1, base);
    writeln(s1);
    BigInt n2 = BigInt(n1);
    string s2 = to!string(n2, base);
    writeln(s2);
}


Expected output:

20335133
20335133


But DMD 2.060beta prints:

...\dmd2\src\phobos\std\conv.d(268): Error: template std.conv.toImpl does not match any function template declaration
...\dmd2\src\phobos\std\conv.d(299): Error: template std.conv.toImpl cannot deduce template function from argument types !(string)(BigInt,int)
...\dmd2\src\phobos\std\conv.d(268): Error: template instance toImpl!(string) errors instantiating template
temp.d(10): Error: template instance std.conv.to!(string).to!(BigInt,int) error instantiating
Comment 1 dlangBugzillaToGithub 2024-12-01 16:15:20 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9930

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB