How to detect a lambda expression get it is signature

bioinfornatics via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 1 16:00:07 PDT 2014


Hi i am looking how to perform this action with traits. Below
some code to show what it fail


Regards


---- CODE
import std.traits       : isDelegate, isSomeFunction,
MemberFunctionsTuple, ParameterIdentifierTuple;


struct section( alias start, alias end )
{
      alias checkStart = start;
      alias checkEnd = end;
}

void main()
{
      alias tmp = bool delegate( string ); // what i would like to
get
      alias s = section!( (word) => word =="a" , (word) => word ==
"b" );
      pragma( msg, isSomeFunction!(s.checkStart) );           //
false
      pragma( msg, isDelegate!(s.checkStart) );               //
false
      pragma( msg, __traits(identifier, s.checkStart) );      //
__lambda1
      pragma( msg, ParameterIdentifierTuple!(s.checkStart) ); //
error
      pragma( msg, MemberFunctionsTuple!( s.checkStart ) );   //
error
}


More information about the Digitalmars-d-learn mailing list