Inplace lambda execution

confuzzled con at fuzzled.com
Fri Mar 28 12:12:45 UTC 2025


I apologize for the newbie question but how do I get the lambda 
the following to execute and return a string instead of the 
function pointer?:

private static immutable string[] typeNames = [staticMap!(T => 
typeof(T).stringof, TypeSeq)];

I currently get this error:

```D
sumtype.d(61): Error: cannot implicitly convert expression `(int 
T) => "int"` of type `string function(int T) pure nothrow @nogc 
@safe` to `immutable(string)`
     private static immutable string[] typeNames = [staticMap!(T 
=> typeof(T).stringof, TypeSeq)];
                                                    ^
```

Thanks in advance.

-- confuzzled


More information about the Digitalmars-d-learn mailing list