Question about std.conv.parse

Jacky jacky at yopmail.com
Tue Jan 30 10:43:53 UTC 2018


On Tuesday, 30 January 2018 at 09:29:22 UTC, Jonathan M Davis 
wrote:
> On Tuesday, January 30, 2018 09:19:22 Jacky via 
> Digitalmars-d-learn wrote:
>> [...]
>
> The first one passes an lvalue. The second one passes an 
> rvalue. parse takes its argument by ref so that what is parsed 
> is removed from the input. As such, it requires an lvalue.
>
>> [...]
>
> You don't. parse requires that you pass it a variable.
>
> std.conv.to does not take its argument by ref, so you can use 
> that instead, but it converts the entire argument instead of 
> just the front portion that matches the requested type. So, if 
> you're trying to convert the entire argument, then you can use 
> to, but if you're trying to just convert the front, then you 
> have to use parse, and that means passing a variable.
>
> - Jonathan M Davis

Thank you very much!I think i should dig deeper into this 
interesting language. :)


More information about the Digitalmars-d-learn mailing list