Re: Obsecure problem 2

2022-08-04 Thread pascal111 via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 21:35:29 UTC, Ruby The Roobster wrote: On Wednesday, 3 August 2022 at 19:11:51 UTC, pascal111 wrote: [...] No need for a code. See, there is a keyword called `ref`, that can be used both in function parameters and in foreach loops, and it is the equivalent of

Re: Obsecure problem 2

2022-08-04 Thread Ali Çehreli via Digitalmars-d-learn
On 8/4/22 00:57, pascal111 wrote: > I don't see my post. Some posts are blocked by the spam filter. (Apparently, your message did not have a sender name and cannot be passed because of that.) Ali

Re: Obsecure problem 2

2022-08-04 Thread pascal111 via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 21:37:50 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 19:11:51 UTC, pascal111 wrote: [...] I agree to the extent that I wanted to do so, and might still have if a delivery hadn't interrupted by post. But one way to encourage others to put in more effort

Re: Obsecure problem 2

2022-08-03 Thread jfondren via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 19:11:51 UTC, pascal111 wrote: On Wednesday, 3 August 2022 at 18:53:35 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 18:33:37 UTC, pascal111 wrote: I changed it to "x=notfunny(x);" and has the same result. Now you are changing the value of the temporary

Re: Obsecure problem 2

2022-08-03 Thread Ruby The Roobster via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 19:11:51 UTC, pascal111 wrote: On Wednesday, 3 August 2022 at 18:53:35 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 18:33:37 UTC, pascal111 wrote: I changed it to "x=notfunny(x);" and has the same result. Now you are changing the value of the temporary

Re: Obsecure problem 2

2022-08-03 Thread pascal111 via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 18:53:35 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 18:33:37 UTC, pascal111 wrote: I changed it to "x=notfunny(x);" and has the same result. Now you are changing the value of the temporary loop variable that is still immediately discarded afterwards.

Re: Obsecure problem 2

2022-08-03 Thread jfondren via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 18:33:37 UTC, pascal111 wrote: I changed it to "x=notfunny(x);" and has the same result. Now you are changing the value of the temporary loop variable that is still immediately discarded afterwards. You should return a new range that has the values you want,

Re: Obsecure problem 2

2022-08-03 Thread pascal111 via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 18:25:50 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 17:33:40 UTC, pascal111 wrote: On Wednesday, 3 August 2022 at 17:09:11 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 16:59:53 UTC, pascal111 wrote: I tried to make a template that receive lambda

Re: Obsecure problem 2

2022-08-03 Thread jfondren via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 17:33:40 UTC, pascal111 wrote: On Wednesday, 3 August 2022 at 17:09:11 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 16:59:53 UTC, pascal111 wrote: I tried to make a template that receive lambda expression to apply it on a given range the user specifies,

Re: Obsecure problem 2

2022-08-03 Thread pascal111 via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 17:09:11 UTC, jfondren wrote: On Wednesday, 3 August 2022 at 16:59:53 UTC, pascal111 wrote: I tried to make a template that receive lambda expression to apply it on a given range the user specifies, but I found non-understood problem: Compare with: ```D auto

Re: Obsecure problem 2

2022-08-03 Thread jfondren via Digitalmars-d-learn
On Wednesday, 3 August 2022 at 16:59:53 UTC, pascal111 wrote: I tried to make a template that receive lambda expression to apply it on a given range the user specifies, but I found non-understood problem: Compare with: ```D auto foo(Range)(Range range) { // remove isInputRange!T test ...

Obsecure problem 2

2022-08-03 Thread pascal111 via Digitalmars-d-learn
I tried to make a template that receive lambda expression to apply it on a given range the user specifies, but I found non-understood problem: '''D module main; import std.stdio; import std.functional; template foo(alias predicate) if (is(typeof(unaryFun!predicate))) {