On 05.12.2015 22:59, Quentin Ladeveze wrote:
---
import std.conv;

string s = "1B2A";

int value = parse!int(s[0..2], 16); //template std.conv.parse cannot
deduce function from argument types !(int)(string, int)
---

Does someone have an idea of why it happens ? The version of parse that
is used here is :

---
std.conv.parse(Target, Source)(ref Source s, uint radix) if
(isSomeChar!(ElementType!Source) && isIntegral!Target && !is(Target ==
enum))
---

And I can't see which template constraint is not respected when I call
it with a slice.

It's the `ref` part. A slice expression cannot be passed in a ref parameter. You can use std.conv.to instead or assign the slice to a variable first.

Reply via email to