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

Reply via email to