title: Test if all elements are equal with C++17 fold-expression
body: <p>I have a function taking a variadic parameter pack and at the beginning I want to check that all elements compare equal. Can I somehow use the new C++17 fold-expressions to write that succinctly as a one-liner? I was thinking</p>
  
  <pre><code>template&lt;typename... Args&gt;
  void func (Args... args)
  {
      ASSERT ((args == ...));
  
      // more code here...
  }
  </code></pre>
  
  <p>but this doesn't work, as it compiles to code that first properly compares the last two arguments, but then compares the third-last argument to the result of the first comparison, which is a bool. What use-case could this type of fold expression possibly have (similar for <code>args &lt; ...</code>)? Is there any chance I can avoid writing a dedicated recursive template to do this?</p>