www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - extract .manglof of template with lambda parameters

reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
so I have a main as follows

int main(string[] args)
{
     int a = 3;
     map!((int x) => x*x)((GlobalPointer!int(&a)),a);
     return 0;
}

I want to get the mangleof of the generated call to map but 
without referencing it in the .o and then pass the mangleof to 
another function. the call to map must still be instantiated.

How do I do this?
Jul 23 2016
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Sunday, 24 July 2016 at 06:03:59 UTC, Nicholas Wilson wrote:
 so I have a main as follows

 int main(string[] args)
 {
     int a = 3;
     map!((int x) => x*x)((GlobalPointer!int(&a)),a);
     return 0;
 }

 I want to get the mangleof of the generated call to map but 
 without referencing it in the .o and then pass the mangleof to 
 another function. the call to map must still be instantiated.

 How do I do this?
the mangled name of the call to map is _D8dcompute5tests4test51__T3mapS40_D4main4mainFAAyaZ9__lambda2FNaNbNiNfiZiZ3mapFNaNbNiNfS8dcompute5types7pointer18__T7PointerVki1TiZ7PointeriZv But how do I get it at compile time?
Jul 23 2016
prev sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Sunday, 24 July 2016 at 06:03:59 UTC, Nicholas Wilson wrote:
 so I have a main as follows

 int main(string[] args)
 {
     int a = 3;
     map!((int x) => x*x)((GlobalPointer!int(&a)),a);
     return 0;
 }

 I want to get the mangleof of the generated call to map but 
 without referencing it in the .o and then pass the mangleof to 
 another function. the call to map must still be instantiated.

 How do I do this?
So I found std.traits.mangledName, but this still leaves a problem of that I can't get the symbol map!((int x) => x*x) without attempting to call it.
Jul 24 2016