On Thursday, 13 May 2021 at 12:56:49 UTC, Alain De Vos wrote:
Writing an inc function is a fascinating voyage.
A function on module level did not worked because it had no this context.

This works:
```
void main(){
ref int inc2(ref int x) return pure nothrow @nogc @safe{
        ++x;
        return x;
}
int x=0;
inc2(inc2(x));
writeln(x);     
```

The thing is i don't find the function pure.

Take a look at
https://dlang.org/phobos/core_atomic.html#.atomicOp

Reply via email to