title: Short circuit of overloaded operator && and || in C++17
body: <p>I read in <a href="http://en.cppreference.com/w/cpp/language/operators" rel="noreferrer">http://en.cppreference.com/w/cpp/language/operators</a>:</p>
  
  <blockquote>
    <p><strong>The boolean logic operators, operator &amp;&amp; and operator ||</strong></p>
    
    <p>Unlike the
    built-in versions, the overloads do not sequence their left operand
    before the right one, and <strong>(until C++17)</strong> cannot implement short-circuit
    evaluation.</p>
  </blockquote>
  
  <p>(My emphasis).</p>
  
  <p>Couldn't find any resource or code example for C++17 supporting short-circuit
  for operator&amp;&amp; and operator||.
  Is it related to C++17 parameter pack fold expression? tried to play with it but couldn't create short circuit behavior for overloaded operator &amp;&amp; and || with C++17 fold expression.</p>
  
  <p>Code:</p>
  
  <pre><code>class A {
      bool val;
  public:
      A(bool b) : val(b) { cout &lt;&lt; "A born as " &lt;&lt; boolalpha &lt;&lt; val &lt;&lt; endl;}
      template&lt;typename ...Args&gt;
      bool operator&amp;&amp;(Args&amp;&amp;... args) {
          return (val &amp;&amp; ... &amp;&amp; args.val);
      }    
  };
  
  int main() {
      cout &lt;&lt; boolalpha;
      cout &lt;&lt; ( A{false} &amp;&amp; A{true} ) &lt;&lt; endl;
      cout &lt;&lt; ( A{true} &amp;&amp; A{false} ) &lt;&lt; endl;
      cout &lt;&lt; ( A{false} &amp;&amp; A{false} ) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>A born as true
  A born as false
  false
  A born as false
  A born as true
  false
  A born as false
  A born as false
  false
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/a/f0b5325899c2fe6b" rel="noreferrer">http://coliru.stacked-crooked.com/a/f0b5325899c2fe6b</a></p>
  
  <p>Note: the sequence of left to right is also not happening in current gcc version, compiled with C++17 flag.</p>