Re: How to detect a lambda expression get it is signature

2014-06-02 Thread Jacob Carlborg via Digitalmars-d-learn

On 02/06/14 01:00, bioinfornatics wrote:

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
}


Have a look at this thread: 
http://forum.dlang.org/thread/lkl0lp$204h$1...@digitalmars.com


--
/Jacob Carlborg


How to detect a lambda expression get it is signature

2014-06-01 Thread bioinfornatics via Digitalmars-d-learn

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
}