Thread overview
std.string.toString() with radix function
Jun 02, 2005
Phoenix
Jun 02, 2005
Uwe Salomon
Jun 02, 2005
Phoenix
June 02, 2005
socket.d(111): function std.string.toString called with argument types:
        (ulong,int)
matches both:
        std.string.toString(long,uint)
and:
        std.string.toString(ulong,uint)


code:

int i = 15;
char [] ui;
ui = std.string.toString(cast(ulong)i,16);

what`s up with it?
June 02, 2005
> socket.d(111): function std.string.toString called with argument types:
>          (ulong,int)
> matches both:
>          std.string.toString(long,uint)
> and:
>          std.string.toString(ulong,uint)
>
>
> code:
>
> int i = 15;
> char [] ui;
> ui = std.string.toString(cast(ulong)i,16);
>
> what`s up with it?

The parameter 16 is signed int by default. D has far simpler overloading rules than C++, and these produce the collision here. Use that instead:

ui = std.string.toString(cast(ulong)i, 16u);

Ciao
uwe
June 02, 2005
Uwe Salomon napsal(a):
>> socket.d(111): function std.string.toString called with argument types:
>>          (ulong,int)
>> matches both:
>>          std.string.toString(long,uint)
>> and:
>>          std.string.toString(ulong,uint)
>>
>>
>> code:
>>
>> int i = 15;
>> char [] ui;
>> ui = std.string.toString(cast(ulong)i,16);
>>
>> what`s up with it?
> 
> 
> The parameter 16 is signed int by default. D has far simpler overloading  rules than C++, and these produce the collision here. Use that instead:
> 
> ui = std.string.toString(cast(ulong)i, 16u);
> 
> Ciao
> uwe
thanks, it works fine.