conver BigInt to string

Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 5 09:13:05 PST 2015


On Thursday, 5 November 2015 at 16:53:50 UTC, Namal wrote:
> On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
>> On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
>>> Hello I am trying to convert BigInt to string like that while 
>>> trying to sort it:
>>>
>>> string s1 = to!string(a).dup.sort;
>>>
>>> and get an error
>>>
>>> cannot implicitly convert expression 
>>> (_adSortChar(dup(to(a)))) of type char[] to string
>>>
>>> what do I do wrong?
>>
>> Try this instead:
>>
>> string s1 = to!string(a).idup.sort()
>>
> If I try it like that i get:
>
> Error: template std.algorithm.sorting.sort cannot deduce 
> function from argument types !()(char[]), candidates are:
>
> /../src/phobos/std/algorithm/sorting.d(996):

string s1 = to!string(a).dup.sort.idup;


More information about the Digitalmars-d-learn mailing list