www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - About alias

reply Sam Hu <samhu.samhu gmail.com> writes:
I am confused again this time about the key word alias when I read below
tutorial:
http://www.dsource.org/projects/tutorials/wiki/MetaBinarySearch
Let's say this one:
template bSearch(alias Match, alias Fail, alias x, A...) {
    const bSearch = bSearchAlg!(0,Match,Fail,x,A);
}

what is the meaning of the 'alias ' before parm Match in the parms list,and
what's the purpose?

Thanks and best regards,
Sam
Mar 31 2009
parent reply Trass3r <mrmocool gmx.de> writes:
Sam Hu schrieb:
 I am confused again this time about the key word alias when I read below
tutorial:
 http://www.dsource.org/projects/tutorials/wiki/MetaBinarySearch
 Let's say this one:
 template bSearch(alias Match, alias Fail, alias x, A...) {
     const bSearch = bSearchAlg!(0,Match,Fail,x,A);
 }
 
 what is the meaning of the 'alias ' before parm Match in the parms list,and
what's the purpose?
 
http://www.digitalmars.com/d/2.0/template.html#TemplateAliasParameter Be aware that alias parameters are only available in D2.0.
Mar 31 2009
parent reply grauzone <none example.net> writes:
Trass3r wrote:
 Sam Hu schrieb:
 I am confused again this time about the key word alias when I read 
 below tutorial:
 http://www.dsource.org/projects/tutorials/wiki/MetaBinarySearch
 Let's say this one:
 template bSearch(alias Match, alias Fail, alias x, A...) {
     const bSearch = bSearchAlg!(0,Match,Fail,x,A);
 }

 what is the meaning of the 'alias ' before parm Match in the parms 
 list,and what's the purpose?
http://www.digitalmars.com/d/2.0/template.html#TemplateAliasParameter Be aware that alias parameters are only available in D2.0.
Wrong: http://www.digitalmars.com/d/1.0/template.html#TemplateAliasParameter
Mar 31 2009
parent reply Trass3r <mrmocool gmx.de> writes:
grauzone schrieb:
 Be aware that alias parameters are only available in D2.0.
Wrong: http://www.digitalmars.com/d/1.0/template.html#TemplateAliasParameter
Oh, I'm sorry, I just confused it with this parameters: http://www.digitalmars.com/d/2.0/template.html#TemplateThisParameter
Mar 31 2009
parent Sam Hu <samhu.samhu gmail.com> writes:
Thank you both,got it that it is a language feature which I have not found
before.
Mar 31 2009