how to get enclosing function as symbol ? (eg: __function__.stringof ==__FUNCTION__)

Timothee Cour thelastmammoth at gmail.com
Sat Aug 17 18:52:37 PDT 2013


Is there any way to get the enclosing function as symbol ?

I'd like something like that:
alternative names would be:
__function__
__context__

----
auto fun(alias caller=__function__)(){
  //caller represents fun1!double
  return ReturnType!caller.init;
}

T fun1(T)(T x){
  assert(__function__.stringof==__FUNCTION__);
  alias fun=__function__;
  assert( is(ReturnType! __function__) == T);
  return fun();
}
void main(){fun1!double();}
----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130817/37f467dc/attachment.html>


More information about the Digitalmars-d-learn mailing list