0

How to stop lambda modifying class member

Refer code below : I have a method of class which uses lambda and modifies member variable from lambda. This lambda has = as capture clause. I thought a should not be modified, but it allows modification. Do we have any mechanism which stops this modification? https://sololearn.com/compiler-playground/cqry108RT02o/?ref=app

30th Jan 2025, 3:10 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Réponse
0
You can add access specifiers. Also, a struct is meant for variables. How about you extract the methods out of it and put it in a class?
7th Feb 2025, 6:21 PM
MattMad
MattMad - avatar