Function constraint vs const parameter?

Ali Çehreli acehreli at yahoo.com
Thu Jun 7 13:52:53 PDT 2012


On 06/07/2012 12:02 PM, Jonathan Crapuchettes wrote:
 > That worked great! I wish there was a simpler solution, but thank you
 > very much for your help.

I am glad. :) Note that isSomeStringArray should have been named 
isSomeStringRange because it ensures that variable.front compiles. Since 
slices are ranges, it still works in your case.

 >> template isSomeStringArray(T)
 >> {
 >> enum isSomeStringArray = is (typeof(
 >> {
 >> T variable;
 >> static assert (isSomeString!(typeof(variable.front)));
 >> }()));
 >> }

Ali



More information about the Digitalmars-d-learn mailing list