to(T, ubyte base) if (isIntegral!T)

Marc Schütz via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 17 04:38:46 PDT 2015


On Saturday, 17 October 2015 at 11:27:39 UTC, Shriramana Sharma 
wrote:
> So given that toImpl is supposed to be internal, shouldn't we 
> have a to! function for specifying the base, something like:
>
> T to(T, ubyte base) if (isIntegral!T && 2 <= base && base <= 36)

It is actually available:

void main() {
     import std.conv;
     assert("1f".to!int(16) == 31);
}

I doesn't appear in the documentation explicitly, but `to` just 
forwards all of its arguments to `toImpl`. I agree that the 
documentation of the `to`-family should be consolidated.


More information about the Digitalmars-d mailing list