Re: opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 17:22:25 UTC, Paul Backus wrote: On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote: It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onlineapp.d(13): Error: cannot uniquely infer `foreach` argument types ``` I

Re: opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
; foreach(it; *stuff) {} } ``` It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onlineapp.d(13): Error: cannot uniquely infer `foreach` argument types ``` I have no idea what i should be doing, does anyone have a clue? Try making opApply const

Re: opApply + const

2024-01-23 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote: It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onlineapp.d(13): Error: cannot uniquely infer `foreach` argument types ``` I have no idea what i should be doing, does anyone have a clue?

Re: opApply + const

2024-01-23 Thread Alexandru Ermicioi via Digitalmars-d-learn
the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onlineapp.d(13): Error: cannot uniquely infer `foreach` argument types ``` I have no idea what i should be doing, does anyone have a clue? Try making opApply const.

opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
Hello, I have the following: ```D struct Stuff { int opApply(scope int delegate(Stuff*) dg) { return 0; } }; void main() { Stuff* stuff; foreach(it; *stuff) {} } ``` It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ```