On Friday, 18 October 2024 at 12:07:24 UTC, Kadir Erdem Demir
wrote:
It seems [=] functionality C++ does not exist in D.
No, D does not have this functionality.
By using a helper function I made that example work.
```d
import std.stdio;
auto localFoo(int x) {
return (){ return x;};
}
On Friday, 18 October 2024 at 12:07:24 UTC, Kadir Erdem Demir
wrote:
It seems [=] functionality C++ does not exist in D.
By using a helper function I made that example work.
[...]
Because 'work' is captured, it is allocated on the heap.
The loops are all assigning values to this 'work' in the
this works for me
```
void aa()
{
void delegate()[] items;
auto captureFuction(int index)
{
return (){
auto localIndex = index;
writeln("index: ", localIndex);
};
}
for(int i =
It seems [=] functionality C++ does not exist in D.
By using a helper function I made that example work.
```d
import std.stdio;
auto localFoo(int x) {
return (){ return x;};
}
void main() {
int x = 10;
auto lambda = (int capturedX = x) {
writeln("Captured reference : ", ca