substitute with predicate won't compile
H. S. Teoh
hsteoh at qfbox.info
Tue Oct 28 20:08:41 UTC 2025
On Tue, Oct 28, 2025 at 07:43:56PM +0000, Bastiaan Veelo via Digitalmars-d-learn wrote:
> Why doesn't this compile?
>
> ```d
> import std;
>
> void main()
> {
> string s;
> //...
> s = s.substitute!((a, b) => sicmp(a, b) == 0, "&", "&",
> "<", "<",
> ">", ">",
> """, `"`,
> "'", "'").array;
> }
> ```
You have all your arguments as CT arguments; I think .substitute wants
the lamdba as a CT argument but the other arguments as RT.
But having said that, after changing the substitution arguments to RT
arguments, it still doesn't compile for me for some reason. So I dunno.
T
--
They say that "guns don't kill people, people kill people." Well I think the gun helps. If you just stood there and yelled BANG, I don't think you'd kill too many people. -- Eddie Izzard, Dressed to Kill
More information about the Digitalmars-d-learn
mailing list