function argument for map: why shorter form does not compile?

Ivan Kazmenko gassa at mail.ru
Sat Jun 20 10:28:24 UTC 2026


Hi.

I have this reduced example:

```
import std.algorithm : map;
import std.format : format;

void main ()
{
	auto a = [1, 2, 3];
	auto b = a.map !(x => format !("%d") (x));  // ok
	auto c = a.map !(format !("%d"));  // orphan format specifier
}
```

Why the line with `b` compiles, but the line with `c` does not?
Shouldn't the compiler deduce the type for the format argument as 
a.front?

Ivan Kazmenko.



More information about the Digitalmars-d-learn mailing list