<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi there,<br>
    <br>
    I recently read the 'More Templates' chapter of Ali's book (<--
    thanks for that ;) ).<br>
    At the section 'Named constraints', there were a definition like
    this:<br>
    <br>
    <small>template isUsable(T)<br>
      {<br>
          enum isUsable = is ( typeof( <br>
          {<br>
              T obj;<br>
              obj.call();<br>
              obj.otherCall(1);<br>
              obj.ye tAnotherCall();<br>
          }() ) );<br>
      }</small><br>
    <br>
    But at Phobos I always see definitions like this (std.range :
    isInputRange):<br>
    <pre><div class="line" id="LC520"><span class="k">template</span> <span class="n">isInputRange</span><span class="p">(</span><span class="n">R</span><span class="p">)</span></div><div class="line" id="LC521"><span class="p">{</span></div><div class="line" id="LC522">    <span class="k">enum</span> <span class="kt">bool</span> <span class="n">isInputRange</span> <span class="p">=</span> <span class="k">is</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span></div><div class="line" id="LC523">    <span class="p">(</span><span class="k">inout</span> <span class="kt">int</span> <span class="p">=</span> <span class="mi">0</span><span class="p">)</span></div><div class="line" id="LC524">    <span class="p">{</span></div><div class="line" id="LC525">        <span class="n">R</span> <span class="n">r</span> <span class="p">=</span> <span class="n">R</span><span class="p">.</span><span class="n">init</span><span class="p">;</span>     <span class="c1">// can d
efine a range object</span></div><div class="line" id="LC526">        <span class="k">if</span> <span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">empty</span><span class="p">)</span> <span class="p">{}</span>   <span class="c1">// can test for empty</span></div><div class="line" id="LC527">        <span class="n">r</span><span class="p">.</span><span class="n">popFront</span><span class="p">();</span>     <span class="c1">// can invoke popFront()</span></div><div class="line" id="LC528">        <span class="k">auto</span> <span class="n">h</span> <span class="p">=</span> <span class="n">r</span><span class="p">.</span><span class="n">front</span><span class="p">;</span> <span class="c1">// can get the front of the range</span></div><div class="line" id="LC529">    <span class="p">}));</span></div><div class="line" id="LC530"><span class="p">}

</span>
<big>What does (inout int = 0) mean/affect here?
I created the same template for myself just without the (inout int = 0) and it worked (at least with a dummy struct)..


- Tim
</big></div></pre>
    <br>
  </body>
</html>