<div class="gmail_quote">On Sun, Oct 30, 2011 at 7:36 AM, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<div class="im">The code as above is canonical. I think restricted templates are the way to go for most code.</div></blockquote></div><div><br></div><div>Yes, they are much simpler to use. </div><div><br></div><div>I went back to traits.d to see how isDynamicArray and isStaticArray were built mostly to figure out the patterns used for them. I  found a couple more  isArray!T  and isSomeString which simplify and generalize the code just a little more:</div>
<div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace"><div>
import std.stdio;</div><div>import std.traits;</div><div>void abc(T) (T parm1)</div><div>  if (isSomeString!T || !isArray!T)</div><div>  {</div><div>  writeln("simpleparm: ", parm1);</div><div>  }</div><div>void abc(T) (T parm1)</div>
<div>  if (!isSomeString!T && isArray!T)</div><div>  {</div><div>  writeln("array : ", parm1);</div><div>  }</div><div>void main(string[] args)</div><div>  {</div><div>    writeln("v4");</div><div>
    abc(1);</div><div>    abc("str");</div><div>    int[] arr = [1, 2];</div><div>    abc(arr);</div><div>    int[2] arr2 = [3, 4];</div><div>    abc(arr2);</div><div>  }</div></font></div></div></div></blockquote>
<div class="gmail_quote"><div><br></div><div>Another one that looked promising is isIterable() for the array.</div><div><br></div><div>All of this begs the question, where do I find the latest doc? Since these are not showing up in the online doc but are clearly in traits.d.</div>
<div><a href="http://d-programming-language.org/traits.html">http://d-programming-language.org/traits.html</a></div><div><br></div><div>Thanks again for your help,</div><div>John</div><div><br></div><div><br></div></div>