I'm relatively new in C++, and I've some questions about memory management.
I'm a C# developer and memory management is easier than C++ because of the garbage collector and I don't know when I've to free memory manually.
For example:
void (*ptr)() = [] { /* 1rst lambda expression code*/ };
ptr = [] { /*2nd lambda expression code*/ };
What happen with the first lambda expression?, Is still in memory?, I've to do something before reassigning 'ptr'?.
If someone can explain to me this particular case and how C++ and memory works I would appreciate it!.